Unanswered: JDBC: ResultSetMetaData.getTableName() and MySQL transition
We are migrating from MySQL to DB2 and have come upon a real problem with how all our existing code is written.
The mm.mysql JDBC driver allowed you to do the following:
ResultSet rs = stmt.executeQuery(
"SELECT * FROM company, user " +
"WHERE user.company_id = company.id");
As I port to DB2, I realize that the "tablename.columnname" notation for the ResultSet.getXXX(String) methods is not a JDBC standard, and the DB2 driver from IBM, as well as two others from HitSW and Merant (DataDirect) don't support it.
We found the "tablename.columnname" notation very intuitive, so we have used it in all of our code. It appears that all of this code must be rewritten, in order to use DB2. Is there a workaround?
I could easily tweak IBM's JDBC driver to do what we want it to, except for the fact that ResultSetMetaData.getTableName(int colNum) always returns nothing. Turns out, so do the other two JDBC drivers that I tried. Is this a function of the DB2 server, and unavoidable? I assume that the DRDA protocol just doesn't allow you to get the table name of the columns in the ResultSet. Is there any way around this problem, or should I just give up and start refactoring all of our code right now?