Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About setBLOb & getBlob

 
shruty sharma
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It´s hard to help without knowing the details.
http://faq.javaranch.com/java/TellTheDetails
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic