Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes About setBLOb & getBlob Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "About setBLOb & getBlob" Watch "About setBLOb & getBlob" New topic
Author

About setBLOb & getBlob

shruty sharma
Greenhorn

Joined: Dec 25, 2008
Posts: 4
Hi!!

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;
msg.setBytes(1,msgval);
// 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.
http://faq.javaranch.com/java/TellTheDetails
 
wood burning stoves
 
subject: About setBLOb & getBlob