aspose file tools*
The moose likes JDBC and the fly likes Inserting Blob throws Exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Inserting Blob throws Exception" Watch "Inserting Blob throws Exception" New topic
Author

Inserting Blob throws Exception

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

Guys,

I'm trying to insert a Blob datatype to a table and I run into the following exception:



My method that does the insert,



I use a Oracle 10.2.0 and JDK 1.4. Any idea as to what is going on?


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Hi Jothi,

Blob columns need to initialize blob place holders, i suppose.
So do you mind first inserting "empty_blob()" and then updating it with blob content?

Something like this.

Regards,

Fatih.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

The problem is not with emply_blob but rather the size limitation of the Blob datatype in Oracle when using a thin JDBC driver.
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
How did you figure it out, and how did you solve it? Curious to learn

Regards,

Fatih.
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

Actually, I get my connection object from the Tomcat JNDI where my web application is deployed. There is a connection property setting that I could do in order to have my CLOB inserted (I changed my BLOD datatype to CLOB) and this is the "SetBigStringTryClob", "true". But I was unable to set this in the Resource configuration in the context.xml of my Tomcat. So the Connection that I get from Tomcat seems not to fit for this situation. So I had to create another explicit Connection through my application and set this property explicitly there and do the insert and retrieval which now seems to work fine.

The following is what I have in the context.xml of my Tomcat



I really cannot understand why the connectionProperties is not respected by Tomcat. If I run using this setting I still keep getting the below exception... (sorry it is in German)



But however when having specifically creating a Connection object through my application rather than using Tomcat JNDI look up, I was able to get it done.

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

Any reason as to why Tomcat is not able to do this?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

Somehow managed to get it work using Tomcat JNDI. Just did the following...

Replaced the classes12.jar from the tomcat/common/lib directory to a ojdbc14.jar and it worked!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inserting Blob throws Exception