Organize your thoughts, including the problems and solutions that arise
Java Connection Access the method
1 ODBC bridging method, which is in Control Panel " ODBC data source ( 32 64 bit "there set DSN Baidu, a bunch of setup methods, and what wow64 32 acc , connected to d disk C.ACCDB database.
Main code: String url = "JDBC:ODBC:ACC";
2 Direct Connection Access Do not use ODBC data source, this is the direct write code
Main code: String url = "Jdbc:odbc:driver={microsoft Access driver (*.mdb,*.accdb)};D bq=d:\\c.accdb";
All code:
Environment (failure):
System: Win8 X64
Myeclips10 ( Bring your own JDK)
Access2010 X86
Either way, it's always been unsuccessful.
always prompt: the ODBC Driver Manager did not discover the data source name and did not specify a default driver, or other error
There are many explanations on the web odbc 64 bit operating system and 32 bit access wow64 ODBC and then set, these I have tried and not succeeded. Finally, according to a netizen hint, found a Microsoft article: http://msdn.microsoft.com/ Zh-cn/library/ff965871.aspx#dataprogrammingwithaccess2010_jdbcodbcexample
in the following: Use + bits and - bit of ACE A detailed explanation is given in the provider.
only - -bit solutions ( -bit of Access , up -bit of Windows )
to implement - -bit solutions, you must do the following:
1. deploy The Access2010 on a four- bit Windows
2. Build a custom data Access Application
+ 32 Access 32 Windows
If you have Access To continue running it without making changes, you must install the Access
32 bit Access works with Access exactly, no need for Span style= "FONT-FAMILY:CALIBRI;" > VBA Code, com ActiveX control makes changes to continue running.
WOW64 Solutions ( -bit of Access , up -bit of Windows )
WOW64technology allows theWindowsbit on the platform to execute +bits of the application. can add +bit ofAccessinstalled in -bit ofWindowson. In this case, your data application must be in Place to communicate with the ACE provider. this is -bitWindowsthe default installation on the operating system, which provides +bitOfficethe compatibility of the application.
despite + -bit applications can run transparently, but do not support mixing two types of code in the same process. applications cannot be linked to a system library (DLL) of -bit applications cannot be linked to a system library of
That is, if your system is a win7,win8, regardless of whether Access is then your myeclipsandJDK must be bit (as I understand it)
I've forgotten how many people I've been pretending to be.
System.out.println (System.getproperty ("Sun.arch.data.model"));
test is - A bit, and then on the reload problem I chose the reload Office , re-installed - bit Office , all problems are solved, whether ODBC to connect or connect directly, all succeed
So now the environment is
system win8 X64 myeclips10 X64 Access2010 X64
The other two environments are not tested.
is that win8 X Myeclips10 bit JDK bit Access2010 X86
or all of it . + bit of
All code:
Import java.sql.connection;import java.sql.drivermanager;import java.sql.sqlexception;public class conn1 { /** * @param args */ public Static void main (String[] args) { // todo auto-generated method stub String driver = "Sun.jdbc.odbc.JdbcOdbcDriver"; try{ class.forname (Driver); string url = "Jdbc:odbc:driver={microsoft Access Driver (*.MDB, *.ACCDB)};D bq=d:\\c.accdb "; //string url = "JDBC:ODBC:ACC"; connection con = drivermanager.getconnection (URL); if (!con.isclosed ()) { system.out.print ("Connection succeeded! "); } }catch (classnotfoundexception e) { e.printstacktrace (); }catch (sqlexception e) { e. Printstacktrace (); } }}
This article is from "Love technology more Love stew noodles" blog, please be sure to keep this source http://zynet.blog.51cto.com/777851/1570462
Problems and solutions of Java connection Access2010 in 64-bit environment