RmiJdbc and Microsoft Access

RmiJdbc Home Page

Connect an MS Access database, using: Or how to make the JDBC/ODBC Bridge become a Type 3 (client/server) JDBC Driver!


Setup the ODBC datasource

You should first install Microsoft Access (of course !), ODBC, the Microsoft Access ODBC Driver, and MS Query to test your ODBC data source: It's all on the Microsoft Office CD-Rom.

Then, download the sample database file that comes with this demo: rjdemo.mdb (an MS Access DB file - here's a version for office 97 - rename it into "rjdemo.mdb" before use).
To check everything's right, we suggest you open rjdemo.mdb with MS Access, and query it: select * from contact

If you still have trouble with Access versions, create the DB yourself:

It works ? Now setup your ODBC data source:

Then, test your ODBC data source with MS Query; Try the following SQL:
select * from contact

If it does not work, your ODBC data source is not properly configured: don't go further until it works fine.

Make a local test with the JDBC/ODBC Bridge

Of course, you need a Java Development Kit (JDK 1.1 or later): Download & installation instructions available at Javasoft's JDBC web pages.
Here's a local example based on the JDBC/ODBC Bridge: compile it (javac localdemo.java) and run it (java localdemo), it should display some data on the screen.

Don't go further until the local example works: it is necessary to make sure the whole chain, from a java application to MS Access data, is well configured.

Install and start RmiJdbc

Network the JDBC/ODBC test with RmiJdbc

The same example as before, but using RmiJdbc !
Compile it (javac rjdemo.java) and run it:
java rjdemo
Of course, the CLASSPATH needs to point on RmiJdbc.jar, otherwise rjdemo won't find the RmiJdbc classes.

Note only two lines of code have really changed to make the demo client/server:
Class.forName("org.objectweb.rmijdbc.Driver").newInstance(); now registers the RmiJdbc Driver instead of the JDBC/ODBC bridge, and the DriverManager.getConnection(...); first parameter has changed, it has been extended to specify a server host address.


Note: the example WON'T RUN if org.objectweb.rmijdbc.RJJdbcServer is not properly launched !!
You can stop org.objectweb.rmijdbc.RJJdbcServer then start the application to see what happens (an exception is raised and there's no data available), then restart org.objectweb.rmijdbc.RJJdbcServer and restart the application (it should work fine again).