>Hi,
>
>I'm trying to update a DB2 table blob field with a pdf file and I'm not having much luck. Anyone have sample code on how to go about this?
>
>Thanks,
>
>John
John,
Check
Re: Inserting data in a blob field Thread #
1014882 Message #
1014888 and
SQL Server field type to store .pdf file Thread #
918564 From DB2 tutorial:
http://www.cn-java.com/download/data/book/jdbc_tutorial.pdf(not sure, if this is helpful)
String insertSQL = "Insert INTO authors VALUES(?, ?)" ;...con = ds.getConnection("java", "sun") ;PreparedStatement pstmt = con.prepareStatement(insertSQL) ;File file = new File("C:/images/rjb.jpg") ;FileInputStream fis = new FileInputStream(file);pstmt.setString(1, "rjb");pstmt.setBinaryStream(2, fis, (int)file.length());if(1 != pstmt.executeUpdate())System.err.println("Incorrect value returned during author insert.") ;pstmt.close();fis.close();System.out.println("BLOB Insert Successful")
If it's not broken, fix it until it is.
My Blog