Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Document doc => xml => blob at mySQL  RSS feed

 
Hussain Al-Zaher
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I'm trying to write Document object content to mySQL as xml file stored as blog.But I guess my code stores it as Document file stored as blog.

ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream out = new ObjectOutputStream(baos);
out.writeObject(doc);
out.close();
String query = "insert into mysql1.fpmltable(id,xml) values (?,?)";
PreparedStatement pstmt = con.prepareStatement(query);
byte[] bytes = baos.toByteArray();
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
pstmt.setString(1,"AD98");
pstmt.setBinaryStream(2, bais, bytes.length);
Any Idea how to write
cahnge Document to xml file then storing it mysql as blob?
Hussain
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might want to serialize the document to XML and then store it in CLOB.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!