• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BLOB insertion into the database hangs

 
Anup Bansal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to insert BLOB data > 4k into the database. I am using the package oracle.sql.blob.
We are using classes12.jar for the drivers.

Attached is the snippet of the code:



The above worked fine on WAS 5.1 with JDK 1.4.2 and classes12.zip. The oracle version being used is 10g
However we recently migrated to WAS 6.1. The JDK version being used is 1.5.1 and the driver calsses were replaced from classwes 12.zip to classes12.jar whcih is compatible with Oracle 10g
The database version is the same
However we observe that under load conditions, the query where we are inserting the empty blob takes an awfully long time and sometimes the session even hangs.
The method BLOB.empty_blob() is deprecated in the new calsses12.jar and so is the method getBinaryOutputStream().
Can this be cause of these delayed performance?

What methods can be used insted of the deprecated ones? (Java doc for Oracle.sql is not very exhausitve)

Can we use ojdbc.jar to get rid of this issue?

Kindly advise.

Thanks & regards,
Anup
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

We are using classes12.jar for the drivers.

Why? Are you using JDK 1.3 or lower? If not I'd upgrade to the latest driver your environment will support (see the Oracle JDBC page for info).
 
Anup Bansal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have upgraded the driver to Ojdbc14.jar but still facing the same issue
Any ideas??
 
Phaneendra Pochinapeddi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is because below select statement might be returning multiple results. I have seen this happening and by making sure that the select query returns only single result, hanging of executeQuery will not happen

 
Bernhard Haeussermann
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if this may help, but I personally don't ever use one database connection to execute more than one query at a time. Consider the following code:



By the time that the Statement stmt2 is created, stmt, the Connection connection may be still be in use by stmt, especially if the select-statement returned more than one row.
As a rule of thumb, I always make the inner SQL-statement run on a separate database connection, as in:



Try it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic