Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: No suitable driver

 
Ganapathi Srinivasan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to run a java program as an NT service that connects to an Oracle DB using a system DSN.
When I start the process under a domain user account I am getting the following excetion:
***EXCEPTION[java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
But the surprising fact is that when I do the same using the default SYSTEM account, the program is able to connect to the database and access records.
Can someone throw light as to why I get this particular problem?
Thanks in advance.
Ganapathi
[ July 09, 2003: Message edited by: Ganapathi Srinivasan ]
 
Marc Haberkorn
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As part of its initialization, the DriverManager class will attempt to load the driver classes referenced in the "jdbc.drivers" system property. This allows a user to customize the JDBC Drivers used by their applications.
** THIS COULD MEAN THAT YOUR jdbc.drivers SYSTEM PROPERTIES DIFFER ON THE TWO DIFFERENT ACCOUNTS YOU'RE USING

For example in your ~/.hotjava/properties file you might specify:

jdbc.drivers=foo.bah.Driver:wombat.sql.Driver:bad.taste.ourDriver
A program can also explicitly load JDBC drivers at any time. For example, the my.sql.Driver is loaded with the following statement:
Class.forName("my.sql.Driver");
When the method getConnection is called, the DriverManager will attempt to locate a suitable driver from amongst those loaded at initialization and those loaded explicitly using the same classloader as the current applet or application.

That is from the JavaDoc of DriverManager, located at: http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DriverManager.html
Another possible problem is that you have different CLASSPATH variables set for the two different accounts. Thus, the driver is able to be found in one account and not in the other. Hopefully this helps some.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic