Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Inserting Blob throws Exception

 
Joe Harry
Ranch Hand
Posts: 10087
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Fatih Keles
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10087
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you figure it out, and how did you solve it? Curious to learn

Regards,

Fatih.
 
Joe Harry
Ranch Hand
Posts: 10087
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10087
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any reason as to why Tomcat is not able to do this?
 
Joe Harry
Ranch Hand
Posts: 10087
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic