我现在正在做一个小程序,我目前可以更新bolb字段,但是无法更新long raw 字段代码如下
upString = "UPDATE " + table + " SET " + culm +" = ?" + " WHERE " + condition;
File file = new File(inPath);
int i = (int) file.length();
byte[] tempData = new byte[i];
int ch;
int end = 0;
FileInputStream in = null; //ファイルの流れる定義
try {
in = new FileInputStream(file);
} catch (Exception e) {
}
while ((ch=in.read())!=-1)
{
tempData[end]=(byte)ch;
end=end+1;
}
PreparedStatement pst = conn.prepareStatement(upString);
pst.setBinaryStream(1,new FileInputStream(file),(int)file.length());
conn.commit();
upString = "UPDATE " + table + " SET " + culm +" = ?" + " WHERE " + condition;
File file = new File(inPath);
int i = (int) file.length();
byte[] tempData = new byte[i];
int ch;
int end = 0;
FileInputStream in = null; //ファイルの流れる定義
try {
in = new FileInputStream(file);
} catch (Exception e) {
}
while ((ch=in.read())!=-1)
{
tempData[end]=(byte)ch;
end=end+1;
}
PreparedStatement pst = conn.prepareStatement(upString);
pst.setBinaryStream(1,new FileInputStream(file),(int)file.length());
conn.commit();
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货