The moose likes JDBC and Relational Databases and the fly likes JDBC Connectivity 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 "JDBC Connectivity" Watch "JDBC Connectivity" New topic

JDBC Connectivity

Siddhesh Desai

Joined: Jun 28, 2004
Posts: 9
Hi,I am Running "" example given on site.
My program has complied correctly. I have used "url" as suggested by Tutorial. While running Java file I m Getting Following Error.

SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified

I have used used dirver path as followed.....

I request you to help me in order to over come this Problem.
Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
you need download the specific database driver , and add the driver jar file into your classpath.

Each database has its own jdbc database driver. for example, oracle use; MySQL use mysql-connector-***-bin.jar. You can find this info in the database vendor website.
Julian Kennedy
Ranch Hand

Joined: Aug 02, 2004
Posts: 823
Siddhesh Desai,

What's the URL suggested by the tutorial? I can't be bothered to go hunting for it. Is it "jdbc:mySubprotocol:myDataSource"? If so then you need to change it to "jdbcdbc:Coffees" or something like that. Then you need to run odbcad32.exe in Windows and set up a System DSN named Coffees. You need to set this up for the database that you've chosen to create your tables on. Follow the step-by-step instructions in the ODBC connection wizard, which are typically different for each type of database.

Alternatively you can follow Edward Chen's advice and forget about the JDBC/ODBC bridge driver and locate or download a JDBC driver specifically for your database of choice. These drivers typically come with instructions on how to use them from within Java.

Hope that helps.

Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
if u are using ms sql server 2000 or ms access then pls configure the dsn
this can be done by going to controlpanel->administrative tools->data sources

open and select the dsn u want to create
usually it works with user dsn

in the program add the line


connection con = driver.getConnection("jdbc dbc sn_name","username","pass");


Pradyut Bhattacharya
Ranch Hand

Joined: Aug 12, 2004
Posts: 63
connection con = DriverManager.getConnection("jdbc dbc sn_name", "un" "pass");
I agree. Here's the link:
subject: JDBC Connectivity
It's not a secret anymore!