How do I convert a string to a clob?

I am trying to do a simple SQL Insert into an Oracle database table that has a field of CLOB data type. I would like to be able to accept string or XML data to insert into this field with an Insert SQL adapter service. How can I convert a string to the java.sql.clob data type so I can do this?

We are using wM 6.1 and v6.0.3 of the JDBC adapter.

StringReader reader1 = new StringReader(myString);

Connection conn=DriverManager.getConnection(ORACLE_URL, ORACLE_uid, ORACLE_password);
String sql=“insert into CLOB_TEST (ID,discription) values (?, ?)”;

PreparedStatement pst=conn.prepareStatement(sql);

pst.setLong(1, id);
pst.setCharacterStream(2, reader1, myString.length());
pst.executeUpdate();

Any solution using the webMethods adapters ?

I think this proposal solution is not appropriate because we don’t want to connect manualy to the database.

At this time I’m using the oracle 10g drivers and that solve many problems (clob size limitation).

I will be very gratefull if someone could tell us how to retrieve a JDBCConnection
It’s very frustratring to not have access to the JDBC connection object.

Regards,

  1. Create a insert Jdbc service which has String input to the CLOB field.
  2. Map the String value to the input.

That’s it. Jdbc adapter will do the conversion from String to CLOB and insert to table.

Hi,

i tried this, it seems to work fine, but I read some threads about limitations wrt to the size of the clob?

Do you know how this goes?

Thanks,

Loïc