Java Resultset Get Primary Key. This method retrieves the description of the primary key columns of a table. Statement st conncreateStatement.
JDBC provides such mechanism but implementation is slightly different for different database systems. So my query would be select k1k2 from table. Here is a small write-up which should help those who still write plain Java JDBC code.
By Viral Patel August 23 2013.
Following is the example which makes use of the ResultSetCONCUR_UPDATABLE and ResultSetTYPE_SCROLL_INSENSITIVE described in the Result Set tutorial. It should be noted that tables you are working on should have Primary Key set properly. When we insert a record in a table that contains an auto increment column then we can easily obtain its id primary key. Systemoutprintlnprimary key table ptab.