Solved

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

Posted on 2014-10-15
4
966 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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

630 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