| Author |
set/getBytes not working well with Oracle 8 BLOB, please help
|
Yuriy Zilbergleyt
Ranch Hand
Joined: Dec 13, 2004
Posts: 429
|
|
Hello, I am trying to store a byte array in an BLOB column. I set it with PreparedStatement.setBytes() and retrieve with ResultSet.getBytes(), and what I put in look nothing like what comes out, even using a simple {0,1,2,3} array for testing. I wrote similar code a few months ago to store serialized Java objects in a MySQL database, and it worked perfectly. Does Oracle do things differently? Is there any other way to store serialized Java objects in an Oracle 8 database? JDO is not an option at this point. Thank you in advance, Yuriy Zilbergleyt
|
 |
Yuriy Zilbergleyt
Ranch Hand
Joined: Dec 13, 2004
Posts: 429
|
|
Hmm, it seems ResultSet.getBinaryInputStream() returns the correct bytes, so I can use it instead of getBytes(). I'm still curious as to why getBytes() doesn't work. Yuriy
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26177
|
|
|
I've used getBytes() successfully with Oracle. Are you using the classes12.zip driver or a different one?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Yuriy Zilbergleyt
Ranch Hand
Joined: Dec 13, 2004
Posts: 429
|
|
I'm using ojdbc14.jar. When you used getBytes, was it on a BLOB or some other column type? Yuriy
|
 |
 |
|
|
subject: set/getBytes not working well with Oracle 8 BLOB, please help
|
|
|