How to create a java.sql.Blob object in Java SE 1.5.0 with a byte[] input?
问题 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 this done. Is there anything similar to this available in J2SE 1.5.0? What is the best way to update a BLOB type column with a byte[] data in J2SE 1.5.0? 回答1: An example, using SerialBlob: import java.sql.Blob; import javax.sql.rowset.serial.SerialBlob; byte[] byteArray = .....; Blob blob = new SerialBlob(byteArray); 回答2: You don't