I am writing a Java Application. I have got a ResultSet. Now I want to find out the coloumn name of the primary key of the table.
Is it possible to get that coloumn name through ResultSet object or ResultSetMetaData Object or any other way.
I didn't find any way to find this.
No. You will not get that information from ResultSet or ResultSetMetadata.
What you want to use for that is DatabaseMetadata class. From that class check getPrimaryKeys method to get the information you want.
Of course, to use this, you will need to know the name of the table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With