Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java connecting to Oracle via JDBC (HPUX)

Status
Not open for further replies.
Mar 17, 2005
44
US
I have inherited a java program that extracts data out of an Oracle 9i database and writes a flat file with some data.

I need to make a slight modification to the name of the view that it extracts data from so we can perform some testing.

Unfortunately, I know jack about Java.

I'm thinking there might be something in the environment missing on the Test server. When I try to compile the program, I get the following error:

Code:
# javac getScaleAcid.java
getScaleAcid.java:15: cannot resolve symbol
symbol  : class OracleDriver  
location: package driver
        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                                                           ^
1 error
sag[5079] test2 /usr/SAG/wrk/epic
#

Anyone able to point me in the direction of what I can look for to see if I'm missing something from my Oracle installation?

{Similar message posted in the Oracle 9 forum}

Thanks
Steve
 
Common practice is to load the driver by its name, which is done behind the scene, when calling the 'Class.forName':
Code:
driver = "oracle.jdbc.driver.OracleDriver";
Class.forName (driver);
That way you don't need to have the Driver available when compiling.

For running, you need the driver, which is normally packed in a jarfile and distributed by oracle (not Sun) but available for free.
There are different drivers for different Versions of Java, i.e. classes12.jar was available when Java-1.2 was up to date - later they choosed the more identifying name ojdbc14.jar.

You get drivers here:

Using 14 Drivers with Java-1.5 (aka 5) is okay while the opposite may fail.
I don't know how drivers depend on database-versions, but afaik it is somewhat relaxed - you don't need a new jdbc-driver for every oracle-Version.

Include the jar-File (with whole path) in the classpath or put it to $JAVA_HOME/jre/lib/ext/ojbc14.jar



seeking a job as java-programmer in Berlin:
 
The Oracle driver is in ORACLE_HOME/server/lib

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Hmmm, looks like it was just that when we recently updated Oracle to 9.2.0.7 that it had rebuild classes12.zip (or updated it) with default permissions of 640. The user running the java program could not read the file.

Thanks to those who responded.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top