This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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)
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
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: