How Do I Access Connection With Java?
I want to access connection on java. But i cant, because it is there odbc problem. Iam useing Windows7 x64. It's not installed odbc driver on windows 7. And is there just System DSN on Odbc Data Source Administator. I want to add but no o开发者_高级运维dbc driver, only sql server.
What can i do?
If you are working on 64 bit version of Windows then you can use 64 bit and 32 bit environment. Such environment consist of Java (JDK or JRE) and database drivers. For Java applications the best way of accessing database is via JDBC driver. Then you need not to worry about 32 or 64 bit environment, you only put .jar
file or files in directory that is part of CLASSPATH
environment variable.
In case of MS Access you can use JDBC-ODBC bridge that is present by default in Sun (now Oracle) implementations of JRE. But before that you must configure ODBC connection with MS-Access database. This can be done via ODBC Manager or via connect string.
I think connect string is easier, because it looks like:
jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\\Nwind.mdb
all you have to do is to point at your .mdb
file. This should work with 32 and 64 bit versions of JRE.
If you want to configure database access in ODBC then do it for both 32 and 64 bit environments using:
c:\windows\syswow64\odbcad32.exe
(32 bit)c:\windows\system32\odbcad32.exe
(64 bit)
Then in connect string you can use DSN name you have just created like:
jdbc:odbc:DSN_NAME
You should consider JDBC-ODBC bridge, for example from OpenLink.
The usual way to access a Db with Java is with a JDBC driver. Most databases have JDBC drivers. Click here for the JDBC tutorial
精彩评论