I need to resolve a bunch of column names to column indexes (so as to use some of the nice ResultSetMetaData
methods). However, the only way that I know how to
Maybe you could use
DatabaseMetaData databaseMetaData = connection.getMetaData();
databaseMetaData.getColumns(null, null, tableName, "%");
It returns one row for each table column.
In this case you'd use the returned ResultSet
itself, not its ResultSetMetaData
.
One advantage of this approach is, that it doesn't interfere with database locking and transactions.