Two Laptop Bag*
The moose likes JDBC and the fly likes ODBC and Microsoft access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "ODBC and Microsoft access" Watch "ODBC and Microsoft access" New topic
Author

ODBC and Microsoft access

Jeff Dube
Ranch Hand

Joined: Jun 14, 2001
Posts: 44
Hi all,
I need to work with a MSACCESS database and i need to connect to this database. Can i connect with JDBC using microsoft access?
I also searched and i often heard about creating a dsn before using odbc driver??? What is dsn?
Is it better to use jdbc or odbc (I am working with windows 2000)?
Thanks
Jeff
Daniel Dunleavy
Ranch Hand

Joined: Mar 13, 2001
Posts: 276
Yes you can use MS ACCESS but you will need a driver for it.
Using ODBC is an interum solution. You can use the JDBC-ODBC bridge. Obviously you need to setup the data source(dsn) in ODBC before trying to connect to it. Basically you are giving it a name and what driver to use. In my case I just called it...MyDatabase and it uses a SQL Server driver. Then the connect uses the name MyDatabase to get to ODBC, and ODBC takes it from there.
Eventually you need to get a driver that supports your database because the JDBC-ODBC is not meant to be a production driver (just for development).
Dan
Alan Watts
Greenhorn

Joined: May 14, 2001
Posts: 28
Jeff,
To add to what Daniel said, in Win98 setting up your DSN (which is like a pointer to a DB file on your system) is relatively straightforward - you need to go to the Control Panel and then open up the ODBC Data Sources icon, and then follow the instructions (fairly simple for Access - perhaps not so simple for say SQLServer). I don't imagine setting up a DSN in Windows 2000 is terribly different.
As Daniel said, using the Sun JDBC:ODBC bridge is a fairly temporary measure - it is a type I JDBC driver, and as I understand it will not work over the internet. So, if you are publishing your Access DB on the web, you will need a commercial driver. I have tried Type III drivers from the following sources (type III drivers are also like the Sun JDBC:ODBC bridge but more sophisticated):
http://www.easysoft.com/ http://www.j-netdirect.com
Both of these work nicely with MS Access in my hands, but you can also view a more complete selection of drivers from the Sun site.
Cheers
Alan Watts
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: ODBC and Microsoft access
 
Similar Threads
Database Connection in .jar
configiring tomcat 4.03 to run my static web page on startup
DSN less MS access Connection using JSP - help needed
Error trying to connect MS Acess 12 database
using netbeans database wizard to connect to msaccess northwind database