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

JDBC-ODBC bridge

9 views
Skip to first unread message

Mike Jackson

unread,
Feb 17, 1997, 3:00:00 AM2/17/97
to

Have edited SimpleSelect.java to begin:

import java.net.URL;
import java.sql.*;

class SimpleSelect {


public static void main (String args[]) {
String url = "jdbc:odbc:Modules";
String query = "SELECT * FROM patient";

try {

// Load the jdbc-odbc bridge driver

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

DriverManager.setLogStream(System.out);

// Attempt to connect to a driver. Each one
// of the registered drivers will be loaded until
// one is found that can process this URL

Connection con = DriverManager.getConnection (
url, "scott", "tiger");


Modules is an ODBC DSN which points to an Access database. This DSN works fine
with MS Query.


But my result is:

DriverManager.getConnection("jdbc:odbc:Modules")
trying
driver[className=sun.jdbc.odbc.JdbcOdbcDriver,context=null,sun.jdbc.odbc.JdbcOd
bcDriver@a63130]
*Driver.connect (jdbc:odbc:Modules)
JDBC to ODBC Bridge: Checking security
No SecurityManager present, assuming trusted application/applet
JDBC to ODBC Bridge 1.1001
Current Date/Time: Mon Feb 17 22:33:41 GMT 1997
Loading JdbcOdbc library
Unable to load JdbcOdbc library
java.sql.SQLException: Unable to load JdbcOdbc library
at sun.jdbc.odbc.JdbcOdbc.<init>(JdbcOdbc.java:90)
at
sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:321)
at
sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:159)
at
java.sql.DriverManager.getConnection(DriverManager.java:90)
at
java.sql.DriverManager.getConnection(DriverManager.java:132)
at
SimpleSelect.main(SimpleSelect.java:51)
Unable to load JdbcOdbc library
Unable to allocate environment
getConnection: no suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(DriverManager.java:110)

at java.sql.DriverManager.getConnection(DriverManager.java:132)
at
SimpleSelect.main(SimpleSelect.java:51)
SQLException: SQLState(08001)
*** SQLException caught ***

SQLState: 08001
Message: No suitable driver
Vendor: 0

What am I doing wrong?

--
*****************************************************************
* *
* Mike Jackson *
* Reader in Software Engineering *
* School of Computing and Information Technology *
* University of Wolverhampton *
* Wulfruna St. Phone: +44 1902 321429 *
* Wolverhampton WV1 1LY Fax: +44 1902 322680 *
* UNITED KINGDOM e-mail: m...@scitsc.wlv.ac.uk *
* *
* WWW: http://www.scit.wlv.ac.uk/~cm1914/home.html *
* *
*****************************************************************


Karl Moss

unread,
Feb 17, 1997, 3:00:00 AM2/17/97
to

The JDBC-ODBC Bridge comes with a library named JdbcOdbc.dll (for
Win96/NT) that should be placed in your windows system directory (i.e.
c:\win95\system). If it is, there may be a windows library that
JdbcOdbc.dll uses that can't be loaded/found. If this is the case,
let me know - I have a utility that will show us what the offending
library is.

Karl Moss
SAS Institute Inc.
sas...@unx.sas.com
Co-author of "Java Database Programming with JDBC"

0 new messages