Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Connection con;
- ResultSet rs;
- PreparedStatement ps;
- try
- {
- con = this.pool.getConnection();
- ps = con.prepareStatement("INSERT INTO users(id, login,password)VALUES(DEFAULT,?,?) RETURNING id");
- Assert.assertNotNull("could not create prepared statement", ps);
- ps.setString(1, "benuasdfaewftzerasdfnameasdf");
- ps.setString(2, "passwort");
- rs = ps.executeQuery();
- Assert.assertNotNull("could not execure query", rs);
- Assert.assertTrue("there wherent any generated keys..", rs.next());
- System.out.print(rs.getInt("id"));
- Assert.assertFalse(rs.next());
- }
- catch(SQLException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
Add Comment
Please, Sign In to add comment