This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes storing byte[] in a (oracle)blob Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "storing byte[] in a (oracle)blob" Watch "storing byte[] in a (oracle)blob" New topic

storing byte[] in a (oracle)blob


Joined: Jan 09, 2002
Posts: 26
hello all,
i've have again a problem with storing a byte[] in a blob under oracle ...
is there a way to store byte[]like this ( or another way any help is great ) ?

i have an example with a filestream, but no idea how to insert byte[] directly ...

Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

the above might work for you. If not try these:
There is more info
Harry Wood

Joined: Jan 28, 2004
Posts: 16
Yeah 'ps.setBinaryStream' worked for me.

...and for reading the blob back again I used:

Trying to use 'resultSet.getBytes' seemed to work, but it always came back with 86 bytes of useless poo (???)

Probably all depends what JDBC driver you're using though.
Ajith Kallambella

Joined: Mar 17, 2000
Posts: 5782
Hello "snoofle"-

Welcome to JavaRanch.

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it - please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.

Enyoy your time here.

Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 32844

Given Snoofle's posting date of 2002, it sounds like he's long gone. I suspect he won't give the display name any "prompt attention"

When you do a search, note that the date of each post is on top. Ones from the past are valuable to read, but not likely awaiting help.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: storing byte[] in a (oracle)blob
It's not a secret anymore!