Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Microsoft Access Craziness

 
Germano Bax
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What JDBC driver are you using? It'd also be better if you posted the actual code being used, just in case.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34195
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is looking like a bug in the JDBC driver though.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JDBC-ODBC bridge has issues for sure, or at least did.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still does. Unfortunately it is (pretty much) the only option if you use Access.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Germano, have you tried switching the column order and see if that works:



and then:


I know, the column ordering shouldn't matter, but I'm just curious. And as Jeanne said, it does look like a driver issue.

 
Germano Bax
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, this is getting pretty funny...
I did what Jaikiran Pai suggested:



and then:


My "fix" is this one:



and then:


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

Thanks guys.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic