• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HELP AGAIN!

 
fengzixuan zheng
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 "fengzixuan@21cn.com".
Thanks and wish you good luck!
[This message has been edited by fengzixuan zheng (edited August 23, 2001).]
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The URl should be "jdbc dbc:yourdatasourcename" In your own case it will be "jdbc.odbc.JavaTest" Since you are using MS Access.

Bosun
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's actually colons not periods. My mistake
jdbcdbc:JavaTest
 
Marcos Maia
Ranch Hand
Posts: 977
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also don�t forget to register your database at the odbc in the control panel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic