This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in inserting to BLOB field

 
Vishnu Murthy
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
When I am trying to insert the value into Blob field using the following code.

String templateText = notifyTemplateBean.getTemplateText();

ByteArrayInputStream byteArrStream = null;

try
{
byteArrStream =new ByteArrayInputStream( templateText.getBytes(ENCODING_CHARSET_ISO88591));
}catch(UnsupportedEncodingException uee)
{
// should never happen
}
query = " INSERT INTO X_NTFY_TMPLT_CONTENT_TABLE
(OBJID, X_TMPLT_CONTENT) VALUES( ?, ? )";
previewPstmt = connection.prepareStatement( query);
previewPstmt.setInt(1, Integer.parseInt(notifyTemplateBean.getTemplateID()));
previewPstmt.setBinaryStream(2, byteArrStream, byteArrStream.available());
int success = previewPstmt.executeUpdate( );

The insertion is successful when byteArrStream is of size <=4000 (4 thousands bytes), if the byteArrStream size if more then 4000 bytes it is through the following Exception

java.sql.SQLException: Io exception: Connection reset by peer: socket write error

I am struck with this problem from the last few days. Any help is appreicated.


I am using Oracle9i database, JBoss4.0.5 server, JDK1.5.
ojdbc14.jar.

-Thank you
Vishnu
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic