header
header
Main Menu
Home
Eviware Store
Downloads
Products
News
Forum
Eviware Blog
Search
FAQs
Customer Area
Support
Documentation
Tutorials
CookBook
Downloads
Forum
Login Form
Welcome, Guest. Please login or register.
January 08, 2009, 10:44:05 pm
Username: Password:
Login with username, password and session length

Forgot your password?
 
Insert a character stream into a CLOB column data (Oracle 9.x)
Welcome, Guest. Please login or register.
January 08, 2009, 10:44:05 pm
Home Help Search Login Register
News: The Forums are up! Welcome to eviware.

+  Eviware Forum
|-+  soapUI
| |-+  soapUI
| | |-+  Insert a character stream into a CLOB column data (Oracle 9.x)
« previous next »
Pages: [1] Print
Author Topic: Insert a character stream into a CLOB column data (Oracle 9.x)  (Read 465 times)
Andreas
Newbie
*
Posts: 3


« 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
Logged
omatzura
Administrator
Hero Member
*****
Posts: 1,666


« Reply #1 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
Logged
Andreas
Newbie
*
Posts: 3


« Reply #2 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 Smiley
Thanks for your help.

regards!
Andreas
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
header header
header
header