Eviware Forum

soapUI => soapUI => Topic started by: Andreas on April 14, 2008, 09:30:11 am



Title: Insert a character stream into a CLOB column data (Oracle 9.x)
Post by: Andreas on April 14, 2008, 09:30:11 am
Hi,

to store the response (22534 bytes) of a soap request in the database into a CLOB column I used the following code in my groovy script:

// get the request object
def request = testRunner.testCase.testSteps["REQUEST"].testRequest

// get the actual messages
def requestContent = request.requestContent
def responseContent = request.response.contentAsString

// Update der Tabelle log um den Request
sql.executeUpdate("Update log set REQUEST = $requestContent where TRANSACTION_ID = $TRANSACTION_ID_NEW")

// Update der Tabelle log um den Request
sql.executeUpdate("Update log set RESPONSE = $responseContent where TRANSACTION_ID = $TRANSACTION_ID_NEW")

In this case an error rises:
Mon Apr 14 09:54:11 CEST 2008:ERROR:java.sql.SQLException: Datengröße größer als max. Größe für diesen Typ: 22534

This means that the string "responseContent" is too long.

So I used the following code:

Connection theCon = DriverManager.getConnection( database );
theStatement = theCon.prepareStatement ("Update log set RESPONSE = ? where TRANSACTION_ID = ?");
theStatement.setString(2, TRANSACTION_ID_NEW);

byte[] charDataBytes = responseContent.getBytes("UTF-8");
java.io.ByteArrayInputStream byteStream =  new java.io.ByteArrayInputStream (charDataBytes);
theStatement.setAsciiStream(1, byteStream, byteStream.available());
rs = theStatement.executeUpdate();

With this code no error rises but the column RESPONSE in table log remains empty.

I hope you have an idea, thanks
Andreas


Title: Re: Insert a character stream into a CLOB column data (Oracle 9.x)
Post by: omatzura on April 14, 2008, 06:42:31 pm
Hi Andreas,

I'm not sure, Oracle seems to have some requirements regarding CLOB handling: http://www.stanford.edu/dept/itss/docs/oracle/10g/java.101/b10979/oralob.htm#i1058035, could you try these instead?

Sorry I can't help you better..

regards!

/Ole
eviware.com


Title: Re: Insert a character stream into a CLOB column data (Oracle 9.x)
Post by: Andreas on April 16, 2008, 10:38:07 am
Hi Ole,

the problem was the installed driver Oracle JDBC Driver version - 9.0.2.0.0. Updated odbc14.jar for Oracle JDBC Driver version - 10.1.0.5.0 and it works fine :)
Thanks for your help.

regards!
Andreas