Writing Data Using JDBC

In most applications in which you need to read data from the database, you often need to insert or update data in the database as well. You can do this using the same manner as before, except that the SQL statement must be changed to actually perform the insert or update. Using the CUSTOMER table for this, you can create a new customer record in the database. Then you can read it back out and update some fields.

As mentioned, the Java classes that you need to use to accomplish this were discussed in the last example. The primary classes that you will need are the Connection, Statement, and ResultSet classes.

Note

If you are using Oracle8i Lite to follow along, go into the ODBC configuration for the POLITE datasource and ...

Get Special Edition Using Java 2 Standard Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.