users@glassfish.java.net

Re: CLOB for LONG String values and OracleConnection from a DataSource

From: <glassfish_at_javadesktop.org>
Date: Wed, 02 Jul 2008 01:05:32 PDT

Hi Petr

clob.setString(1, longStringValue);
ps.setClob(paramNum, clob);

works fine and easier to use. Maybe a writer is need in case or larger objects.

The code to insert data in a table with a xmltype field is like this:

ps=cn.PrepareStatement("insert into myTable(pkField, xmlField) values(?, xmltype(?))");
ps.setString(1, pkValue);
ps.setClob(2, clob);

and it also works with "update myTable set xmlFiled=xmltype(?) where pkField=?".

That code has been working while the value length of the xmlField was less than 4K. I have never needed an stored procedure. Simple insert or update staments have worked always fine.

Thanks you very much
Aniceto Perez
[Message sent by forum member 'aperezymadrid' (aperezymadrid)]

http://forums.java.net/jive/thread.jspa?messageID=283890