I have created a table in Derby Database with Auto Increment.
For example:
CREATE TABLE USERS (ID BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1) , USER_NAME)
I have to check if the id column detail now,
String query = "SELECT ID FROM USERS ";
conn = new Kanexon().db();
stmt = conn.prepareStatement(query);
rs = stmt.executeQuery();
rsmd = rs.getMetaData();
if(rs.next()){
System.out.println("ColumnLabel: "+rsmd.getColumnLabel(1));
System.out.println("ColumnName: "+rsmd.getColumnName(1));
System.out.println("ColumnTypeName: "+rsmd.getColumnTypeName(1));
}
It gives me output something like this:
ColumnLabel: ID
ColumnName: ID
ColumnTypeName: BIGINT
Is there a way by which I can check that the ID column is auto incremented or not.