Abhijit Basu

Greenhorn
+ Follow
since Mar 02, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Abhijit Basu

Let me describe the setup first. I am uisng JDK 1.3. The classes12.jar (JDBC driver) has been placed in C:\jdk1.3\jre\lib\ext folder, so I have not explicitly added the jar to the classpath. My test program can make a JDBC connection fine from this windows machine to Oracle. Now, I create a jar of this code and the windows service basically loads the jar up when Windows starts. When run in this manner, I get ClassNotFoundException for "oracle.jdbc.driver.OracleDriver". However, I have a bat file that starts the jar up the same way (java -jar ReportServer.jar) and that seems to be able to make JDBC connections just fine. Below is a code excerpt being used for the connection:

......
DriverManager.registerDriver((Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance());
//Get a Connection to the database
myConn = DriverManager.getConnection(dbUrl, rptUsername, rptPassword);
.........

I am catching all the required exceptions etc.

Also, here's how the environment variables are set:
JAVA_HOME=C:\jdk1.3
Path=D:\apache;C:\jdk1.3\bin;D:\Oracle\Ora81\bin;.............
CLASSPATH=.;D:\Oracle\Ora81\bin;C:\jdk1.3;.....................

Any ideas? I dont know what I am doing wrong. This needs to run as a windows service. Thanks!
19 years ago