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

java.sql.SQLException: No suitable driver

1 view
Skip to first unread message

Jeff Dutton

unread,
May 17, 2001, 3:16:15 PM5/17/01
to
I have been scratching my head over this one for awhile. Below is a
code snippet for my connection using the jdbc:odbc bridge:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
DatabaseItemImpl.dbConn =
DriverManager.getConnection("jdbc:odbc:sched", USER, PASSWORD);//line 48

Pretty straight forward. The code compiles fine. FYI: The class
actually extends UnicastRemoteObject.

I get the following runtime error:

java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at SchedDbaseImpl.main(RMISchedDbaseImpl.java:48)

I have configured "sched" as a data source name using Windows ODBC Data
SOurce Administrator. In fact, I have other applications using it just
fine with other databases on my system. Thus, I know that is not the
problem.

Any ideas why getConnection method is not finding the driver?


thanks very much!
Jeff


S

unread,
May 20, 2001, 12:01:16 PM5/20/01
to
I just solved this problem at my company. It was caused by a malformed URL
passed to DriverManager.getConnection( url, user, password ). The _real_
cause was an embedded space in the database name, because when someone
modified the config file, they left a trailing space in that parameter.

So there's probably something wrong with your URL. Try double-checking the
Windows ODBC Data Source Administrator and make sure there's no trailing
space in the data source name. Also try this:
System.err.println ( "url = '" + url + "'" );

This will print your URL inside single quotes, to see if there are any
problems with it.

Hope that helps,
Dan

"Jeff Dutton" <sloo...@home.com> wrote in message
news:3B042348...@home.com...

0 new messages