aspose file tools*
The moose likes JDBC and the fly likes Inserting Clob data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Inserting Clob data" Watch "Inserting Clob data" New topic
Author

Inserting Clob data

Shane W
Ranch Hand

Joined: Aug 31, 2007
Posts: 30
Hi All
I need to insert a very large text formed by appendng names.So i created table with Column as Clob
When I try to insert this string using
pStmt.setString() method,i get the foll error
java.sql.SQLException: Data size bigger than max size for this type:

I know that i have the pStmt.setClob() method available, but string can't be cast as Clob.How do i achieve this?
Please note that i have to form the string by appending,no other way out.

SHane
Shane W
Ranch Hand

Joined: Aug 31, 2007
Posts: 30
Hi all
I've tried using the foll piece of code
oracle.sql.CLOB newClob = oracle.sql.CLOB.createTemporary(conn, false, oracle.sql.CLOB.DURATION_CALL);

This works fine if i run a standalone piece of code.But when i use it in my app,running on JBoss, I get class cast exception.

Any clue why this is happeing?
Using oracle 9.2 and JBoss 4.1

Shane
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2476
    
    7

I get class cast exception.
What does the exception say?

Regards, Jan


OCUP UML fundamental and ITIL foundation
youtube channel
Ugender Rekulampally
Ranch Hand

Joined: Nov 14, 2005
Posts: 130
Shane,
try reading that big string into character stream. it works for me.


'rpaXmlInputStr' is my big XML in string format.

Thanks,
Ugender
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inserting Clob data
 
Similar Threads
use of CLOB,help me.
How to use oracle 9.2 driver for oracle817's CLOB?
Convert large string to Clob
insert CLOB into MS SQL Server 2K
Converting a String to Clob for insert into DB