I'm relatively new to databases, but I think I've mastered the basic concepts and I was wondering how I would store a java object in a database. As far as I understand, I would just have to serialize it and store it int the database as a blob, but I don't exactly know how i would do this code-wise. I would be eternally grateful if someone could help me out. Thanks! - Chris
posted 16 years ago
Hi Chris, Here is how I would do it: Blob binobj = rs.getBlob("BINOBJ"); PreparedStatement pstmt = con.prepareStatement( "UPDATE MYTABLE SET BINARYOBJ = ?"); pstmt.setBlob(1, binobj); pstmt.executeUpdate(); Hope this helps! Regards, Milind
[This message has been edited by Milind Kulkarni (edited August 19, 2000).]
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads