smeacham

createStatement()

Sep 18th, 2012
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. Statement stmt = conn.createStatement();
  2. try {
  3.     stmt.executeUpdate( "INSERT INTO MyTable( name ) VALUES ( 'my name' ) " );
  4. } finally {
  5.     //It's important to close the statement when you are done with it
  6.     try { stmt.close(); } catch (Throwable ignore) { /* Propagate the original exception
  7. instead of this one that you may want just logged */ }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment