JDBC 2.0中提供了对SQL3标准中引入的新的数据类型,如Blob(binary large object)、Clob(character large object)、Array 对象、REF(对象参考,object reference)和 UDT(用户定义数据类型,user-defined datatype)等的支持。这些新的数据类型结合在一起,使得数据库设计人员可以创建更丰富的模式,并简化了对复杂数据的处理和持久化。
例如,我们要向tbl_User表中插入用户的照片,这时就可以使用流将Blob对象导入数据库中:
String sql = "intsert into tbl_User values(?, ?)";
PreparedStatement pstmt = con.prepareStatement(sql) ;
File file = new File("C:/images/photo.jpg") ;
FileInputStream fis = new FileInputStream(file);
pstmt.setString(1, "John"...[ 查看全文 ]