This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Need help Urgently Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
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
Similar Threads
How to store & retrieve a video file from database?
Getting error while saving image as blob in oracle
Uploading a text file to a blob in MySql, then downloading that file to local file system
How to upload a byte array into BLOB column?
how can we store image and get it back from SQL Server