This document contains code to insert and retrieve data from a database using JDBC. The first code sample inserts a new record into a Student table. The second code sample retrieves all records from the Student1 table and prints the results. It loads the JDBC driver, connects to the database, creates a statement object, executes an insert or select query, and prints the output.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
527 views2 pages
AJP No.18
This document contains code to insert and retrieve data from a database using JDBC. The first code sample inserts a new record into a Student table. The second code sample retrieves all records from the Student1 table and prints the results. It loads the JDBC driver, connects to the database, creates a statement object, executes an insert or select query, and prints the output.