Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> HELP : JDBC question
Hi all,
I am trying to insert a record with CLOB column using the following java code and oracle JDBC driver. Althought it works, I want to rewrite it to a more generic way using JDBC 2.0 API. Could anyone teach me how to do it so that it will easily to migrate the database from Oracle to other database server if necessary. Thanks.
PreparedStatement stmt = con.prepareStatement( " SELECT clob_field FROM StaffRecord WHERE staff_id = ? FOR UPDATE ", ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE );
stmt.setLong(1, staff_id); ResultSet rs = stmt.executeQuery(); if (rs.next()) { CLOB lob_loc = null; lob_loc = ((OracleResultSet)rs).getCLOB("clob_field"); String clob_value = "A very long message...."; lob_loc.putString(1, clob_value); rs.updateRow(); } stmt.close();Received on Tue Feb 19 2002 - 04:17:28 CST