Class.forName("oracle.jdbc.OracleDriver");
String url = "jdbc:oracle:thin:@192.168.1.5:1521:orcl";
Connection con = DriverManager.getConnection(url,"mj","123");
byte[] b = new byte[] {'a','b','c','d','e','f','g','h','i','j'};
Statement s = con.createStatement();
// s.exeute("insert into t2 values(1,'ASDADD',EMPTY_BLOB())");
// ResultSet rs = s.executeQuery("select b from t2 for update");
// while(rs.next()){
// BLOB blob = (BLOB) rs.getBlob("B");
// OutputStream os = blob.getBinaryOutputStream();
// os.write(b);
// os.close();
// }
Statement s1 = con.createStatement();
ResultSet rs1 = s1.executeQuery("select B from t2 for update");
while(rs1.next()){
BLOB blob = (BLOB) rs1.getBlob("B");
System.out.println(blob.length());
}
注释掉上面的代码,后面的blob.length()输出九尾0了,不注释,输出为10.这是什么原因