Hi Darius.
try to use :
rs.getBlob().getBinaryStream() for select
and ps.setBinaryStream() for insert/update.
Oracle documentation state that you must use oci version 8.1.6 connecting to
a 8.1.6 database in order for that to work. (Otherwise, you will have to
cast ps.getBlob() to oracle.sql.BLOB and that didnt work for me with jBoss).
BTW, if you ever manage to make it work as a CMP entity bean, let me know...
Shahar.
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Darius Davidavicius
Sent: Monday, November 27, 2000 7:17 PM
To: jBoss
Subject: RE: [jBoss-User] JBoss+Oracle+BLOB
Hi Shahar, Karlson
When i changed from BLOB to LONG ROW its wors ok. But i still would like to
work with BLOB. (or CLOB )
I changed configuration i now using oci ( <attribute
name="URL">jdbc:oracle:oci8:@DARIUS</attribute>) but i still have the same
problem
>what java methods do you use on the driver for select/insert/update ?
keyData == BLOB
Insert:
ps = con.prepareStatement(
"insert into Keys"
+" (keySeqId,keyHashValue,keyData)"
+" values (?,?,?)");
ps.setInt (1, aKeySeqId);
ps.setLong(2, aKey.longHashCode());
ByteArrayOutputStream aBAOS = new
ByteArrayOutputStream(2048);
ObjectOutputStream aOOS = new ObjectOutputStream(aBAOS);
aOOS.writeObject(aKey);
aOOS.close();
ps.setBytes(3, aBAOS.toByteArray());
ps.executeUpdate();
Select:
ps = con.prepareStatement(
"select keySeqId, keyData"
+" from Keys where keyHashValue=? ");
ps.setLong(1, aKey.longHashCode());
rs = ps.executeQuery();
while(rs.next())
{
byte [] aBytes = rs.getBytes(2);
ObjectInputStream aOIS = new ObjectInputStream(
new
ByteArrayInputStream(aBytes));
aKey = (StringKey) aOIS.readObject();
}
And I get java.io.StreamCorruptedException: InputStream does not contain a
serialized ob
ject while creating ObjectInputStream aOIS object;
Thanks for helping,
D&D
On Sun, 26 Nov 2000 15:22:28 +0200, Shahar Solomianik wrote:
>Hi.
>I've experienced similiar problems with CLOB.
>what java methods do you use on the driver for select/insert/update ?
>there are some versions of classes12.zip. The actual driver you are using
is
>what you define in the db url for the getConnection.
>i.e.
>for oci driver you'll write jdbc:oracle:oci8:@<tns-name>
>and for thin driver you will write :
>jdbc:oracle:thin:@<host-machine>:<port>:<sid>
>
>when working with BLOB's its recommended to work with oci driver since it
is
>more efficient
>
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED]]On Behalf Of Darius Davidavicius
>Sent: Friday, November 24, 2000 6:00 PM
>To: [EMAIL PROTECTED]
>Subject: [jBoss-User] JBoss+Oracle+BLOB
>
>
>hi all
>
>I using last version of JBoss, Oracle8i
>
>I working with Bean managed entity bean and i want to store/load data into
>Oracle BLOB field.
>I can store data but i cant read them.
>For me it seems like problems in the JDBC draiver. Now i using
classes12.zip
>
>Does anyone worked with it?
>I need consultations.
>D&D
>
>
>
>
>--
>--------------------------------------------------------------
>To subscribe: [EMAIL PROTECTED]
>To unsubscribe: [EMAIL PROTECTED]
>Problems?: [EMAIL PROTECTED]
>
>
>
>--
>--------------------------------------------------------------
>To subscribe: [EMAIL PROTECTED]
>To unsubscribe: [EMAIL PROTECTED]
>Problems?: [EMAIL PROTECTED]
>
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]