Comments - About MariaDB Connector/J

8 years ago Vladislav Vaintroub

Not sure what you're refering to when speaking about primary keys. For autoincrement, the things are standard, and you could use getGeneratedKeys() as described here for example .

8 years ago Azzouz Nezar

Thank you for the link.

The situation in my case is different. Here is a simplified code for my example where normally I get the auto-increment:

ResultSet rscol = null;

String autoInc =null;

int colAutoInc=0;

Statement stmt = cnx.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);

ResultSet rs = stmt.executeQuery("Select * from " + db_table);

DatabaseMetaData dbmd =cnx.getMetaData();cnx=Connection

for (i = 1; i <=numberOfColumns; i++) {

rscol = dbmd.getColumns(tableCatalog, tableSchema, db_table, columnName);

while ( {

autoInc = rscol.getString(12);returns "auto-increment" if column is in fact auto-increment

if (!autoInc.equals("")) colAutoInc=i;



Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.