- 12 rows Jan 18, 2018 The Microsoft JDBC Driver for SQL Server is a Type 4 Java Database.
- Download the Microsoft JDBC Driver 6.0 for SQL Server, a Type 4 JDBC driver that provides database connectivity through the standard JDBC application program interfaces (APIs) available in Java Platform, Enterprise Editions.
Active1 year, 3 months ago
There are several third-party JDBC drivers out there for Microsoft Access database, and we recommend UCanAccess - a pure Java JDBC Driver for Access that allows Java developers and JDBC client programs to read/write Microsoft Access databases.
I want connect my MS access file with Java GUI program,but I have problem with connection....
I have Windows 7 64b, and ms office 2007.When I opened the ODBC driver manager in the control panel I havent found any driver for Microsoft Access (maybe when I started the ODBC is started running the 64bit ODBC, now I think is running the 32bit ODBC. I read this and I make it : 'jdbc-odbc connection for window 7 64 bit machine.. 1 . Right click Data source (ODBC)..go to properties change the folloing thing
target [ %SystemRoot%SysWOW64odbcad32.exe ] start in : [ %SystemRoot%System32 ]
press enter and continue as admin source: source link' ) Now when I start in conctrol pannel the ODBC I can see the driver screenshoot
My program code(I tried two ways but I have same error):
error
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
rjdkolb5,64977 gold badges5252 silver badges6666 bronze badges
artinyartiny
9 Answers
Use UCanAccess JDBC Driver :
So for your example it will be
Anthony O.Anthony O.Connection conn=DriverManager.getConnection('jdbc:ucanaccess://'+path)
10.7k88 gold badges7070 silver badges124124 bronze badges
If you are using Windows 64-bit you probably need to go to this path
C:/Windows/SysWOW64/odbcad32.exe
Then I noticed that you are using the direct path instead creating new
System DSN
, your direct path is correct till the path to the access file you must give the full path like this :jdbc:odbc:Driver= Microsoft Access Driver (*.mdb, *.accdb);DBQ=path/to/Invertory.mdb'
To get the path you probably need to use
java.io.File
that have a method returns the abslute path to the file see the example :AzadAzad
I answered a similar question enter link description here a while back.
Basically at that time:
- You could connect to Ms-Access from 32 bit java through the JDBC-ODBC bridge
- You could not connect to a 32 bit Odbc driver through the JDBC-ODBC from 64 bit java. There was a message telling you that you can only connect from a 32 bit programs
- While Microsoft does provide a 64 bit Ms-Access driver, it did not work with Java's 64 bit JDBC-ODBC driver.
Since then there seems to be a new open-source Ms-Access JDBC Driver Ms-Access JDBC driver. I have no Idea how good it is.
Community♦
Bruce MartinBruce Martin8,62211 gold badge1818 silver badges3232 bronze badges
You just missing something in your code right here :
You need to add
Jorn{}
between Driver=
and )=;
. Like this Below12.2k99 gold badges6262 silver badges9494 bronze badges
KaJasBKaJasB
Karthikeyan Vaithilingam5,12677 gold badges3333 silver badges5555 bronze badges
Avijit DasAvijit Das
The problem is that you should run on Java 32 bit try to install latest JDK and it will work
I run it using JDK version 'jdk-7u67-windows-i586.exe'
Ahmed SalemAhmed Salem
On a 64 bit system, you should:
- run as admin accessdatabaseengine_64.exe
- run java - 7-64 bit - jre.
1,51311 gold badge2121 silver badges3434 bronze badges
jrjayswaljrjayswal
if you are working in NETBEANS then after unzipping ucanacess.zip file add all jar file in the classpath using property window of project click on compile tab and add jar file then compile and test app.
Manoj PandeyManoj Pandey
JDBC-ODBC MS-ACCESS CONNECTION STOPPED WORKING IN JDK8. I solved the issue by installing JDK7 along with JDK8 in the same PC, once installed JDK7 I assigned it as the JDK version to use in my project as follows in Netbeans:
1.RIGHT CLICK THE PROJECT IN THE LIST > CLICK PROPERTIES
2.CLICK LIBRARIES ON THE LEFT NAVIGATION TREE
3.CLICK BUTTON MANAGE PLATFORMS > CLICK BUTTON ADD PLATFORM...
4.FOLLOW WIZARD, DESPITE IT SHOWS JAVA STANDARD EDITION CLICK NEXT
5.NAVIGATE TO C:Program Files (x86)Java AND SELECT THE FOLDER OF JDK7 > CLICK NEXT
6.THE FIELD AUTOFILL WITH THE RIGHT INFO... > THEN CLICK FINISH
7.SELECT THE JDK PLATFORM FROM THE LIST > CLICK CLOSE > OK
8.JDK7 SHOULD SHOW IN LIBRARIES PACKAGE.
JDK7 in Libraries PackageClick Back in Browser to return here after looking at the image...
From here on everything must run smoothly.
Hope it solves your problem.
Thanks.
marc_s606k137137 gold badges11591159 silver badges12921292 bronze badges
J. SilvermannJ. Silvermann
Not the answer you're looking for? Browse other questions tagged javaodbc or ask your own question.
Jdbc Odbc Driver For Ms Access
In this tutorial I will teach you how to connect java (jdbc) with ms access database.
MS Access is a part of Microsoft Office and used as database management system (dbms).
For making a new database go to MS Access > Blank Database. Give a name to database and click on Create button to create the database.
Also Read: How to Connect Java (JDBC) with MySQL or Oracle Database
Below example shows jdbc ms access database connectivity.
How to Connect Java (JDBC) with MS Access Database
2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 | importjava.sql.DriverManager; publicclassJDBCMSAccess{ //location where database is present in the system Stringdatabase='D:UsersTCPDocumentsDatabase1.accdb'; try{ Class.forName('sun.jdbc.odbc.JdbcOdbcDriver'); //creating connection string Stringurl='jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ='+database; //establishing connection System.out.println('Connection Successful!'); } }catch(Exceptione){ } } |
JDK 1.8
If you are using jdk 1.8 then you will get ClassNotFoundException. Just read below article to solve the error.
Read: Solve java.lang.ClassNotFoundException: sun.jdbc.odbc.JdbcOdbcDriver Error
Jdbc Driver For Access 2013
Above program is really easy to understand. You can ask your queries in comment section.