将Blob转换为字节数组的最简单方法是什么?我正在使用MYSQL,我想将Blob数据类型转换为字节数组。
Iam使用Java编程语言:)
mySql blob类具有以下功能:
blob.getBytes
像这样使用它:
//(assuming you have a ResultSet named RS) Blob blob = rs.getBlob("SomeDatabaseField"); int blobLength = (int) blob.length(); byte[] blobAsBytes = blob.getBytes(1, blobLength); //release the blob and free up memory. (since JDBC 4.0) blob.free();