import java.sql.* ;
import java.util.* ;
import java.io.* ;
class DataBaseFactory{
public static Connection getConnection() {
// ...
}
}
class Demo{
public static void main(String []args) throws SQLException {
Connection con = DataBaseFactory.getConnection() ;
// This is throwing exception
// PreparedStatement ps = con.prepareStatement("insert into user values(?,?)", Statement.RETURN_GENERATED_KEYS) ;
// But this is working fine
PreparedStatement ps = con.prepareStatement("insert into user values(?,?)") ;
}
}
Thanks in advance.