Hi there:
I'm
testing some examples from the book "JDBC Database Access with Java", and I'm getting this error message when I try to run it:
SQLExpection:[Microsoft][Administrador de controladores ODBC]El nombre del origen de datos no se encontro y no se especifico ningun controlador predeterminado.
SQLExpection:[Microsoft][ODBC Drivers Administrator]The name of the data source was not found and a predeterminated driver was not especified.
The code of the program is:
import java.sql.*;
// Create the
Coffee Table.
public class CreateCoffees {
public static void main(
String args[]) {
String url = "jdbc

dbc:CafeJava";
Connection con;
String createString;
createString = "create table COFFEES " +
"(COF_NAME varchar(32), " +
"SUP_ID int, " +
"PRICE float, " +
"SALES int, " +
"TOTAL int)";
Statement stmt;
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
System.out.println("trying to connect"}"); /* after this line the error is generated. */
con = DriverManager.getConnection(url, "", "");
System.out.println("statement");
stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
The database "cafeJava.mdb", is located on the same source directory that this program. Can anybody help me, please?.
Thanks in advance.