58,451
社区成员




@Test
public void test() {
Connection connection = null;
PreparedStatement preparedStatement = null;
try {
connection = JDBCTools.getConnection();
String sql = "insert into teacher values(?,?,?)";
preparedStatement = connection.prepareStatement(sql);
preparedStatement.setInt(1, 6);
preparedStatement.setString(2, "柴静");
preparedStatement.setBlob(3, new FileInputStream("柴静.jpg"));
preparedStatement.executeUpdate();
} catch (Exception e) {
// TODO: handle exception
}finally {
JDBCTools.Release(preparedStatement, connection);
}
}
} catch (Exception e) {
// TODO: handle exception
}
catch (Exception e) {
e.printStackTrace();
}