Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JDBC:ODBC driver error - DSN not found

1 view
Skip to first unread message

Bill George

unread,
May 24, 2000, 3:00:00 AM5/24/00
to
I am using this code (complied with the JDK1.3 version for Windows) for a
JDBC application using an ODBC DSN for a Windows NT Access 2000 database:

public static void main (String args[])
throws SQLException, IOException {

System.out.println("Loading JDBC-ODBC driver");
try {Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (Exception e) {e.toString();}

System.out.println("Connecting to Order database");
String url = "jdbc:odbc:OrdersDriver";
Connection gmrConn = DriverManager.getConnection(url);

System.out.println("After db connection");
gmrConn.close();


The System DSN is named OrdersDriver in the ODBC Driver manager. I have
also tried a File DSN named OrdersDriver in the same directory as the java
class. I have tested both with a VB app and they are working as ODBC DSNs.

I get the following program output:

Loading JDBC-ODBC driver
Connecting to Order database

Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Driver
Manage
r] Data source name not found and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at BuildJDBC.main(BuildJDBC.java:17)


Is there some special configuration that must be done to get the jdbc:odbc
driver to work on Windows? Any information will be greatly appreciated.

Thank you.

0 new messages