java插入瀚高数据库blob字段(APP)
目录
环境
系统平台:Linux x86-64 Red Hat Enterprise Linux 7
版本:5.6.4
症状
问题原因
1、MySQL插入blob数据写法
InputStream in = new FileInputStream("文件路径");
ps.setBlob(3, in);
2、Oracle插入blob数据方法
(1)ResultSet.getBinaryStream 和PreparedStatement.setBinaryStream对BLOB进行读写
如果BLOB中存储的是文本文件的话,就没问题,如果是二进制文件,传输就会有问题
(2)插入更新
insert xxxtable(A,B,C) values(empty_blob(),'xxx','yyyy')
conn.setAutoCommit(false);
select A from table where xxx=? for update
3、瀚高
ResultSet.getBinaryStream 和PreparedStatement.setBinaryStream对BLOB进行读写
解决方案
InputStream in = new FileInputStream("文件路径");
ps.setBlob(3, in);
更多解决方案请登录【瀚高技术支持平台】 查看https://support.highgo.com/#/index/docContent/4111ddcb021ceb21