Code Comments
Programming Forum and web based access to our favorite programming groups.I have inserted an xml to the mySQL database as a BLOB type using JDBC and java, with the code, Statement stat=con.createStatement(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); StreamResult result = new StreamResult(baos); DOMSource source = new DOMSource(doc); trans.transform(source, result); String query = "insert into policy(id,type,xml) values (?,?,?)"; PreparedStatement pstmt = con.prepareStatement(query); byte[] bytes = baos.toByteArray(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); pstmt.setInt(1,0); pstmt.setString(2,"Description"); pstmt.setBinaryStream(3, bais, bytes.length); pstmt.executeUpdate(); how can i retrieve the same from the database, so that i can display it or output to a file.. please help..thanks in advance sarath
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.