I'm facing a pretty weird issue with Microsoft Access. I got the task of migrating data from MS Access to another database, but some data transformation is required, and the following issue is driving me crazy:
I'm running the following SQL statement on my JDBC code:
And reading with:
It should be simple and straightforward, but rs.getString(1) throws the exception java.sql.SQLException: No data found. rs.getString(2) reads the data without issues. The same SQL statement when run inside MS Access produces lots of results on both the first and second columns.
Back to JDBC, I changed the SQL statement to:
Now I can read the values correctly, by skipping the first column (rs.getString(1) would throw me that No data found exception):
Is this a jdbc driver issue or a Ms Access issue? Please advise on what can be wrong. I wonder what else I might expect with this crappy database.
Hi, this is getting pretty funny...
I did what Jaikiran Pai suggested:
My "fix" is this one:
Any query on any table of this database have the issue. Looks like it is related with the first column of each table. Luckily I'm able to perform my task by fetching the column twice, ignoring the first column and fetching from the second. I didn't face any other issues so far. Once I'm finished with this migration, I'll never look back... unless I decide to post this case on thedailywtf.com