What is the easiest way to convert byte array into Blob data type in MYSQL with java programming language?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Blob blob = connection.createBlob();
blob.setBytes(1, bytes);
回答2:
You may try this one, if you are using hibernate.. Possibly the easiest way! :)
Blob blob = Hibernate.createBlob(bytes);
回答3:
Blob fileBlob = new javax.sql.rowset.serial.SerialBlob(byteArray);