| 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: 758
|
|
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 "jdbc dbc: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");
|
 |
 |
|
|
subject: JDBC Connectivity
|
|
|