It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes SQLException: [Microsoft][ODBC Driver Manager] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "SQLException: [Microsoft][ODBC Driver Manager]" Watch "SQLException: [Microsoft][ODBC Driver Manager]" New topic

SQLException: [Microsoft][ODBC Driver Manager]

Glenn Castro
Ranch Hand

Joined: Aug 24, 2003
Posts: 78
It's my first time to use JDBC and I got the following message on running a simple JDBC code.
SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
How can I resolve this problem. Can anyone teach me how to setup the database and what should i put on the following code:
import java.sql.Connection;
import java.sql.*;
public class CreateCoffees {
public static void main(String args[]) {
String url = "jdbc dbc:COFFEEBREAK"; //COFFEEBREAK is the name of the DB
Connection con;
String createString;
createString = "create table COFFEES " +
Statement stmt;
try {
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
try {
con = DriverManager.getConnection(url, "sa", "");
stmt = con.createStatement();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());

Glenn Castro<br />Sun Certified Web Component Developer
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

sounds like your computer can't find the datasource named COFFEEBREAK. Make sure this ODBC datasource is set up on your computer and that it is spelled the same as in your java app.
Mr. C Lamont Gilbert
Ranch Hand

Joined: Oct 05, 2001
Posts: 1170

What OS are you using? I will assume win2K. It has to be windows.
"COFFEEBREAK" is the name of the datasource not the database file name.
to set up a datasource go to control panel. Open administrative tools. Double click "Data Sources(ODBC)" go to system DSN tab. choose add. Pick the microsoft access driver. give it the datasource name COFFEEBREAK. choose create, and give it whatever filename you wish and put it where you like.
You are all set.
I agree. Here's the link:
subject: SQLException: [Microsoft][ODBC Driver Manager]
It's not a secret anymore!