public static void main(String[] args) throws SQLException, IOException {
Connection conn = null;
PreparedStatement prop = null;
ResultSet rs = null;
conn = JdbcUtils.getConnection();
String sql = "insert into imags(imag) values=(?)";
prop = conn.prepareStatement(sql);
File file = new File("e:\\图片\\46.jpg");
InputStream in = new BufferedInputStream(new FileInputStream(file));
prop.setBinaryStream(1, in,(int)file.length());
int num = prop.executeUpdate();
System.out.println(num);
JdbcUtils.close(conn, prop, rs);
}
这段代码错哪里了啊,数据库连接很正常 |
|