Article View: borland.public.jbuilder.java.language
Article #8692Problem with blob insertion
From: Manuel EVENO
Date: Wed, 07 Mar 2001 15:45
Date: Wed, 07 Mar 2001 15:45
48 lines
2719 bytes
2719 bytes
Hello,
I'm trying to insert a serialized object into a oracle database (working
with blob).
My oracle version is 8.1.6, the JDBC driver I use is Oracle JDBC Driver Thin
2.0 for Java 2
and the jdk is provided by JBuilder 4 (i.e. jdk 1.3)
The insert happens with no problem but when I try to retrieve a object
which size is greater than 4Ko (approximatly), I get this error
"java.io.StreamCorruptedException: Caught EOFException
while reading the stream header"
To insert, I do :
creating a preparedStatement
PreparedStatement pstmt=con.prepareStatement(
"insert into SOURCECONFIG (CONFIG) values(?)");
I've already tried various solutions.
First one :
Converting my object into a byte array
and using :
pstmt.setBytes(1, data);
==> The previous error is thrown
Second one : Working with Pipe
Converting my object into a byte array (byte[] data;) to get the
length
PipedOutputStream writer = new PipedOutputStream();
PipedInputStream reader = new PipedInputStream(writer);
ObjectOutputStream oos = new ObjectOutputStream(writer);
oos.writeObject(config);
oos.flush();
pstmt.setBinaryStream(2, reader, data.length);
==> The previous error is thrown
Third one :
Converting my object into a byte array (byte[] data;)
pstmt.setBinaryStream(2, new ByteArrayInputStream(data), data.length);
==> The previous error is thrown
Can someone help me ? Is this an error from me, the jdk, the oracle driver,
the oracle database ?
If someone has already worked with blob .....
Thanks
Bye
Technical Details
Message-ID:
<985m87$5ua$1@reader1.fr.uu.net>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!isdnet!inetway!inetway.net!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a146,c583775225220860,start X-Google-Attributes: gid10a146,public X-Google-Thread: f74b3,c583775225220860,start X-Google-Attributes: gidf74b3,public X-Google-Thread: 107d46,c583775225220860,start X-Google-Attributes: gid107d46,public X-Google-ArrivalTime: 2001-03-07 07:46:06 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!isdnet!inetway!inetway.net!not-for-mail From: "Manuel EVENO" <mektoub@ifrance.com> Newsgroups: borland.public.jbuilder.java.language,comp.lang.java.databases,comp.lang.java.programmer Subject: Problem with blob insertion Date: Wed, 7 Mar 2001 16:45:26 +0100 Organization: UUNET Lines: 50 Message-ID: <985m87$5ua$1@reader1.fr.uu.net> NNTP-Posting-Host: 212.155.65.1 X-Trace: reader1.fr.uu.net 983981127 6090 212.155.65.1 (7 Mar 2001 16:05:27 GMT) X-Complaints-To: abuse@fr.uu.net NNTP-Posting-Date: 7 Mar 2001 16:05:27 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300