问题
How to connect to a Microsoft Access-based database in a Windows using JDBC code?
What syntax is to be written for Type-1 and Type-4 types of the drivers?
Class.forName(" ");
Is the above syntax different for everytype of the driver we use? How can we define and identify the type of the driver we use??
If possible then also specify for the oracle also the driver syntax to be loaded..
回答1:
You can use JDBC-ODBC bridge by calling:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
Then you can use JDBC database URL in form:
jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\\Nwind.mdb
or if you configure your database in ODBC manager you can use its alias:
jdbc:odbc:northwind
回答2:
I recommend a cross-platform Access JDBC driver called UCanAccess. It works great and there are lots of examples on the site (to help the original poster.)
回答3:
JDBC/ODBC driver is a platform dependent and can be used only in Windows OS. Also, there are some platform independent JDBC drivers, for example: StelsMDB JDBC driver (http://www.csv-jdbc.com/stels_mdb_jdbc.htm)
回答4:
To connect Java with MS Access, you need a JDBC driver. I still don't think Microsoft do one do they! http://www.easysoft.com/applications/microsoft-access/jdbc-odbc.html
来源:https://stackoverflow.com/questions/9863482/jdbc-with-ms-access