在存储在DB2数据库中的Blob中进行修改后,我想获得Blob的大小,并将其传递给Update语句,这是我的代码:
while (rs.next()) {
subId = rs.getString(1);
fileName = rs.getString(2);
fileBlob = rs.getBlob(3);
String blobStr = new String(fileBlob.getBytes(1l, (int) fileBlob.length()));
String str = blobStr.replace("TEST", "TEST DATA");
System.out.println("Submission number= " + subId + "; File Name= " + fileName
+ "; Data= " + str);
//here where i should get the size to pass it to FILE_SIZE in update statement
PreparedStatement pstmt = connection.prepareStatement("UPDATE SUBMFILE SET FILE_SIZE=? WHERE SUBM_ID='"+ line + "'");
pstmt.setInt(1, 4916);
pstmt.executeUpdate();
connection.commit();