File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Need help Urgently Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Need help Urgently" Watch "Need help Urgently" New topic

Need help Urgently

Himanshu Jhamb
Ranch Hand

Joined: Aug 01, 2001
Posts: 134
Hi All.
I am having a very strange problem. Let me get to it right away.
We are using Weblogic 6.0 running on a Linux box with Oracle 8.1.6 as the DB.
One of the tables has 2 blob fields where we store 2 blobs per request. These two fields are in XML format in the application realm. We use the following method in a preparedStatement for storing the blobs in the DB.
public void setBinaryStream(int parameterIndex,
InputStream x,
int length)
throws SQLException
We use a ByteArrayInputStream for the parameter 'x' above.
Now this is what is happening...
I convert the XML into a ByteArrayInputStream, put it in a preparedStatement with the above method & call the executeUpdate method on it.
When I look retrieve this inserted row, I get back the XML I inserted with 3 fields missing. These three fields are present somewhere in the middle of the XML when I insert it.
What puzzles me more is that this does not happen all the time. Sometimes the retrieval retrieves the complete Blob just fine.
Just to be sure that it is indeed the insertion that is the problem, I do a dbms_lob.getlength(Blob column) & the length of the blob stored in the DB is less than the one I inserted. That proves that the insert is not inserting the data properly & something flaky is happening at the time of the insert.
Any ideas as why this is happening?? Is there a problem with the setBinaryStream( ) method ??? Any suggestions are more than welcome as this has got me completely stumped !
I would appreciate a quick response as this is quite an urgent piece in my app & I need a solution ASAP.
Thanks in advance.
- Himanshu

Himanshu Jhamb<br />SCJP2 v1.2 (April 2002)<br />SCJP2 v1.4 (May 2002)
I agree. Here's the link:
subject: Need help Urgently
It's not a secret anymore!