File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: About setBLOb & getBlob
 
Similar Threads
storing BLOB
inserting BLOBs into MySQL database
How to convert an object into BLOB
inserting blob with CMP
Inserting image into the oracle database