Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> HELP : JDBC question

HELP : JDBC question

From: Chris <chris.lo_at_cyberwisdom.net>
Date: Tue, 19 Feb 2002 18:17:28 +0800
Message-ID: <a4t55k$a0q$1@tenorhorn.hk.dyxnet.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US