程序能顺利运行,但“OK”总不能输出,且blob字段写不进。
不知是什么原因:,有没有更好的方法写blob字段?
Class.forName("oracle.jdbc.driver.OracleDriver"
.newInstance();
con = DriverManager.getConnection("jdbc
racle:thin:@192.168.0.100:1521:zhwu","usr","password"
;
stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_UPDATABLE);
ResultSet rs = stmt.executeQuery("SELECT t.* FROM testfile t WHERE t.fileid=2"
;
File file = new File("zzz"
;
int fileLength = (int)file.length(); //只有几百字节。
FileInputStream fin = new FileInputStream(file);
bytes[] b = new Bytes[fileLength];
fin.read(b,1,fileLength);
rs.updateBinaryStream("filedoc", new ByteArrayInputStream(b, 1, fileLength), fileLength);
System.out.println("OK "
;
环境:jdk1.3.1,oracle 8.1.6,linux
|