• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception with Access database

 
Alejandro Barrero
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my code:

filePath is "C:\MyWorkspaces\Eclipse\References\References\src\References.accdb". I can open the database with Access. The code has run in the past and I am still using Java 32 bits, which was the problem some time ago.
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please tell what Exception are you getting ?
 
Alejandro Barrero
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your prompt reply. The exception is "java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Cannot open database '(unknown)'. It may not be a database that your application recognizes, or the file may be corrupt.".
 
Paul Clapham
Sheriff
Posts: 21557
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, the file which your filePath variable refers to isn't an Access database which can be opened using the MDB device driver, which is what you specified. Presumably when you open it with Access it's using a different method. Since its extension is ".accdb" and not ".mdb" that's probably the case. You would have to specify the driver for ACCDB in your connection string rather than the driver for MDB.
 
Alejandro Barrero
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your time. Strangely the code fail;s in Eclipse Kepler but works on MyEclipse. It is not a JDBC problem; I am puzzled and I hope I can find the answer somewhere.
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alejandro Barrero wrote:Thank you very much for your time. Strangely the code fail;s in Eclipse Kepler but works on MyEclipse. It is not a JDBC problem; I am puzzled and I hope I can find the answer somewhere.

Then perhaps the issue is more related to configuration than rather the DB. Make sure that you have configured everything in kepler exactly the same as you had done in MyEclipse.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic