Solved

Unable to connect to MS-Access database using jdbc-odbc

Posted on 2014-10-15
4
957 Views
Last Modified: 2014-10-16
Hi

I trying to connect to ms-access database using jdbc-odbc on linux, I installed unixodbc and mdbtools and isql runs fine but in connecting to access to db it give me problem.
Unable to connect to database: java.sql.SQLException: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
java.sql.SQLException: [unixODBC][Driver Manager]Data source name not found, and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)

And here is my sample java code:
   File f = new File("/home/hp/db1.mdb");
String url =  "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" + f.getAbsolutePath()+";";
            Class.forName(driverClassName);
            dbConn = DriverManager.getConnection(url, "","");

Open in new window

and odbcinst.ini
[MDBToolsODBC]
Description             = MDBTools Driver
Driver          = /usr/lib/i386-linux-gnu/odbc/libmdbodbc.so
Setup           = /usr/lib/i386-linux-gnu/odbc/libmdbodbc.so
FileUsage               = 1
UsageCount              = 1

Open in new window

Please help

Regards
sentil
0
Comment
Question by:senthil kumar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40383624
AS far as I know, the driver "Microsoft Access Driver (*.mdb, *.accdb)" only runs on Windows, not Linux.  I haven't found any driver that does work although I got part of this code to work:  https://gist.github.com/amirkdv/9672857
0
 

Author Comment

by:senthil kumar
ID: 40383952
Hi

Thanks for your response, it seems removing "Microsoft Access Driver (*.mdb, *.accdb)" also gives the same exception. Please lemme know how to resolve this problem.

Regards
Sentil
0
 

Author Closing Comment

by:senthil kumar
ID: 40384274
Hi There


The code is absolutely suits our requirements, the last of the link given http://code.google.com/p/mdb-sqlite/ best suits our requirements . Thank you very much and to your team.


Regards
Sentil
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40384740
You're welcome, glad to help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question