Java examples for java.sql:PreparedStatement
get New Row generated Key from PreparedStatement
//package com.java2s; import java.sql.PreparedStatement; import java.sql.ResultSet; public class Main { public static int getNewRowKey(PreparedStatement statement) throws Exception { ResultSet rs = statement.getGeneratedKeys(); if (rs.next()) { return rs.getInt(1); }/*from w w w .java 2 s .c o m*/ return -1; } }