Comments - About MariaDB Connector/J

9 years, 1 month 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 (rscol.next()) {

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.