java中如何将大于10000的字符串,插入oracle数据库中的blob类型字段中?
2013-05-26
展开全部
不要用blob,用clob类型。先插入一个empty_clob(),然后用Statement myStmt = conn.createStatement();
ResultSet clobResultSet=myStmt.executeQuery("SELECT "+strCLOBColName
+" FROM "+strTable
+" WHERE "+ strIdColName +" ='" + strIdValue+ "' FOR UPDATE ");
CLOB myClob = (oracle.sql.CLOB)clobResultSet.getClob(strCLOBColName);
myClob.putString(1,strBuff);
myStmt.execute("COMMIT");
clobResultSet.close();
myStmt.close();
conn.setAutoCommit(true);
ResultSet clobResultSet=myStmt.executeQuery("SELECT "+strCLOBColName
+" FROM "+strTable
+" WHERE "+ strIdColName +" ='" + strIdValue+ "' FOR UPDATE ");
CLOB myClob = (oracle.sql.CLOB)clobResultSet.getClob(strCLOBColName);
myClob.putString(1,strBuff);
myStmt.execute("COMMIT");
clobResultSet.close();
myStmt.close();
conn.setAutoCommit(true);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询