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 HELP AGAIN! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "HELP AGAIN!" Watch "HELP AGAIN!" New topic


fengzixuan zheng
Ranch Hand

Joined: Aug 02, 2001
Posts: 31
Sorry for my stupid, I still don't know how to form the data source url for creating a connection. Example: If I have a MS Access database- "JavaTest.mdb", I write code as follows, It always says cannot find the data source. WHAT should the variable "url" be?

Class.forName("jdbc.odbc.JdbcOdbcDriver"); //loads the driver
String url = "jdbc dbc:MS Access;DBQ=c:\\JavaTest.mdb";
Connection con = DriverManager.getConnection(
url, "userID", "passwd");

If somedoay can help me, please mail to me "".
Thanks and wish you good luck!
[This message has been edited by fengzixuan zheng (edited August 23, 2001).]
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
The URl should be "jdbc dbc:yourdatasourcename" In your own case it will be "jdbc.odbc.JavaTest" Since you are using MS Access.


So much trouble in the world -- Bob Marley
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
It's actually colons not periods. My mistake
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Also don�t forget to register your database at the odbc in the control panel.
I agree. Here's the link:
subject: HELP AGAIN!
It's not a secret anymore!