daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. con = this.pool.getConnection();
  2.             ps = con.createStatement();
  3.             // ps = con.prepareStatement("INSERT INTO users(login,password)VALUES(?,?)", );
  4.             Assert.assertNotNull("could not create prepared statement", ps);
  5.             // ps.setString(1, "benutzerasdfnameasdf");
  6.             // ps.setString(2, "passwort");
  7.             ps.executeUpdate("INSERT INTO users(login,password)VALUES('die henne','fick')",
  8.                     Statement.RETURN_GENERATED_KEYS);
  9.             rs = ps.getGeneratedKeys();
  10.             Assert.assertNotNull("could not execure query", rs);
  11.             int key;
  12.             Assert.assertTrue("there wherent any generated keys..", rs.next());
  13.             if(ps.getGeneratedKeys().next())
  14.             {
  15.                 System.out.print(ps.getGeneratedKeys().getInt(1));
  16.             }
  17.             else
  18.             {
  19.                 System.out.println("jo");
  20.             }
  21.             Assert.assertFalse(rs.next());
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top