Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int executeBlob(String query, byte[] bytes){
- try
- {
- PreparedStatement stmt = getConnection().prepareStatement(query, Statement.RETURN_GENERATED_KEYS);
- Blob blob = getConnection().createBlob();
- blob.setBytes(1, bytes);
- stmt.setBlob(1, blob);
- stmt.executeUpdate();
- ResultSet result = stmt.getGeneratedKeys();
- result.next();
- return result.getInt(1);
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement