senthil kumar
asked on
Unable to connect to MS-Access database using jdbc-odbc
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.cre ateSQLExce ption(Unkn own Source)
at sun.jdbc.odbc.JdbcOdbc.sta ndardError (Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQL DriverConn ect(Unknow n Source)
at sun.jdbc.odbc.JdbcOdbcConn ection.ini tialize(Un known Source)
at sun.jdbc.odbc.JdbcOdbcDriv er.connect (Unknown Source)
at java.sql.DriverManager.get Connection (Unknown Source)
at java.sql.DriverManager.get Connection (Unknown Source)
And here is my sample java code:
Regards
sentil
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.cre
at sun.jdbc.odbc.JdbcOdbc.sta
at sun.jdbc.odbc.JdbcOdbc.SQL
at sun.jdbc.odbc.JdbcOdbcConn
at sun.jdbc.odbc.JdbcOdbcDriv
at java.sql.DriverManager.get
at java.sql.DriverManager.get
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, "","");
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
Please helpRegards
sentil
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
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
You're welcome, glad to help.
ASKER
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