当前位置: 技术问答>java相关
怎么使用jdbc往db2中写入BLOB?
来源: 互联网 发布时间:2015-11-18
本文导语: DB2版本7.2 | DB2的JDBC驱动很标准,直接用就可以了(和Oracle的必须使用Oracle的类的模式不同) PreparedStatement stmt = con.prepareStatement(sql); File f = new File("C:\sample.txt"); FileInputStream is = new FileI...
DB2版本7.2
|
DB2的JDBC驱动很标准,直接用就可以了(和Oracle的必须使用Oracle的类的模式不同)
PreparedStatement stmt = con.prepareStatement(sql);
File f = new File("C:\sample.txt");
FileInputStream is = new FileInputStream(f);
stmt.setBinaryStream(1,is,(int)f.length());
stmt.executeUpdate();
PreparedStatement stmt = con.prepareStatement(sql);
File f = new File("C:\sample.txt");
FileInputStream is = new FileInputStream(f);
stmt.setBinaryStream(1,is,(int)f.length());
stmt.executeUpdate();