File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Class.forname() and Access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Class.forname() and Access" Watch "Class.forname() and Access" New topic

Class.forname() and Access

rick casey

Joined: May 12, 1999
Posts: 4
I'm trying to get started with the good book "Database Programming with JDBC and Java". Am using Access as a local database but cannot find the driver class name needed for Class.forname(). Can anybody point this out?
Also: I really like this eporkchop site. Just what I needed to learn more Java.

Rick Casey
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
If you downloaded Java from the Sun webpage,
try the following:
For the url, you will have to find out what your computer calls it. You can double-click on the ODBC icon in the Control Panel to add, modify and delete database references. Given the above classname and a database reference called, "OLE_DB_NWind_Jet", the next two lines of code may look like:
String url = "jdbc dbc:OLE_DB_NWIND_Jet";
Connection con = DriverManager.getConnection(url, "", "");
Hope that helps.
paul wheaton

Joined: Dec 14, 1998
Posts: 20972

It looks like UBB is trying to be cute.
That that you see should be replaced with

Hopefully this came out okay.

permaculture Wood Burning Stoves 2.0 - 4-DVD set
paul wheaton

Joined: Dec 14, 1998
Posts: 20972

Now I've turned off the smiley face stuff which should turn off that problem with the colon followed by the letter "oh".
This added message should fix the thread.
It should say
String url = "jdbc dbc:OLE_DB_NWIND_Jet"
paul wheaton

Joined: Dec 14, 1998
Posts: 20972

Well, that didn't work.
I'll look into this some more.
In the mean time, the statement is
String url = "jdbc: odbc:OLE_DB_NWIND_Jet"
but without spaces.
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

rick casey, i think you looking database connectivity. so you can use above code fragment. if you using mysql, download mysql-connector-java-5.1.13-bin.jar file and use it.
knowladge is power when applied.

Software Engineer(BSC):SCJP 1.5
(Knowledge is power when applied)
I agree. Here's the link:
subject: Class.forname() and Access
jQuery in Action, 3rd edition