Insert Java byte[] object into an H2 table and then retrieve it again

非 Y 不嫁゛ 提交于 2019-12-06 07:24:54

The best way is to use a prepared statement:

byte[] object = ...;
PreparedStatement prep = conn.prepareStatement(
    "insert into TEST (OBJECT) values (?)");
prep.setBytes(1, object);

An alternative is to convert the byte array to a hex value, but that's more complicated.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!