File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes About setBLOb & getBlob Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "About setBLOb & getBlob" Watch "About setBLOb & getBlob" New topic

About setBLOb & getBlob

shruty sharma

Joined: Dec 25, 2008
Posts: 4

I want to insert byte array in database schema as follows:
table message
msgid number(5),
messagevalue BLOB

I have done this in following way But I am getting NULL pointer exception.

//byte[] msgval .. contains byte values like 49 50 53 etc.

Blob msg;
// for prepared statement I have used st2.setBlob(4,msg);
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
It´s hard to help without knowing the details.
I agree. Here's the link:
subject: About setBLOb & getBlob
It's not a secret anymore!