connection = DriverManager.getConnection(URL);
PreparedStatement
stmt = connection.prepareStatement("INSERT INTO TBL_KOMMENTAR " +
"(KMT_USR_ID, KMT_GRT_ID, KMT_TEXT) " +
"VALUES (?, ?, ?)", PreparedStatement.RETURN_GENERATED_KEYS);
stmt.setInt(1, userID);
stmt.setInt(2, gerichtID);
stmt.setString(3, comment);
stmt.executeUpdate();
ResultSet rs = stmt.getGeneratedKeys();
while(rs.next()) {
int test = rs.getInt(1);}