daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Jun 13th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Connection con;
  2.         ResultSet rs;
  3.         PreparedStatement ps;
  4.         try
  5.         {
  6.             con = this.pool.getConnection();
  7.             ps = con.prepareStatement("INSERT INTO users(id, login,password)VALUES(DEFAULT,?,?) RETURNING id");
  8.             Assert.assertNotNull("could not create prepared statement", ps);
  9.             ps.setString(1, "benuasdfaewftzerasdfnameasdf");
  10.             ps.setString(2, "passwort");
  11.             rs = ps.executeQuery();
  12.             Assert.assertNotNull("could not execure query", rs);
  13.             Assert.assertTrue("there wherent any generated keys..", rs.next());
  14.             System.out.print(rs.getInt("id"));
  15.             Assert.assertFalse(rs.next());
  16.         }
  17.         catch(SQLException e)
  18.         {
  19.             // TODO Auto-generated catch block
  20.             e.printStackTrace();
  21.         }
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