*
The moose likes JDBC 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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JDBC Connectivity" Watch "JDBC Connectivity" New topic
Author

JDBC Connectivity

Siddhesh Desai
Greenhorn

Joined: Jun 28, 2004
Posts: 9
Hi,I am Running "CreateCoffees.java" example given on sun.java 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.....
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

I request you to help me in order to over come this Problem.
Thanks...
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 class14.zip; 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.

Jules
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

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

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

thanks


Pradyut
http://pradyut.tk/
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: http://aspose.com/file-tools
 
subject: JDBC Connectivity