1Resultset result;
2PreparedStatement prep;
3String query = "INSERT INTO myRel (data) VALUES (?)";
4
5prep = db.prepareStatement(query ,Statement.RETURN_GENERATED_KEYS);
6
7result = prep.getGeneratedKeys();
8
9if(result.next() && result != null){
10 System.out.println("Key: " + result.getInt(1));
11} else {
12 System.out.println("No, Nop nada");
13}
14