How to create a java.sql.Blob object in Java SE 1.5.0 with a byte[] input?

后端 未结 3 1522
孤城傲影
孤城傲影 2021-02-12 20:14

I want to create a Blob object from a byte[] input to update a table using PreparedStatement#setBlob(). In J2SE 6, we have java.sql.Connection#createBlob() to get t

3条回答
  •  终归单人心
    2021-02-12 20:29

    You don't need to actually create the Blob itself. When doing a prepared statement, use a ByteArrayInputStream for the parameter when setting the blob parameter.

提交回复
热议问题