wood burning stoves*
The moose likes Beginning Java and the fly likes Package oracle.sql does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package oracle.sql does not exist" Watch "Package oracle.sql does not exist" New topic
Author

Package oracle.sql does not exist

bob reilly
Ranch Hand

Joined: Jan 22, 2007
Posts: 44
I'm attempting to compile a java file - this is a simple compile - no eclipse - I'm using notepad for testing java concepts (accessing Clob data).

That said when attempting to compile my code I'm getting error messages indicating:

C:\JFiles>javac CLOBFileExample.java
CLOBFileExample.java:37: package oracle.sql does not exist
import oracle.sql.*;
^
CLOBFileExample.java:40: package oracle.jdbc does not exist
import oracle.jdbc.*;
^
CLOBFileExample.java:230: cannot resolve symbol
symbol : class CLOB
location: class CLOBFileExample
CLOB xmlClob = null;
^
CLOBFileExample.java:256: cannot resolve symbol
symbol : class OracleResultSet
location: class CLOBFileExample
xmlClob = ((OracleResultSet) rset).getCLOB("xml_Clob_field");
^
CLOBFileExample.java:325: cannot resolve symbol
symbol : class CLOB
location: class CLOBFileExample
CLOB xmlClob = null;
^
CLOBFileExample.java:346: cannot resolve symbol
symbol : variable rseClobt
location: class CLOBFileExample
rseClobt.next();
^
CLOBFileExample.java:347: cannot resolve symbol
symbol : class OracleResultSet
location: class CLOBFileExample
xmlClob = ((OracleResultSet) rset).getCLOB("xml_Clob_field");
^
7 errors

These error messages make me suspect that the classpath is not configured properly. When I review that - there doesn't appear to be any reference to an oracle jar file. I do have an oracle client configured on my workstation.

BTW - "java -version" yields: "java version "1.6.0_20". Furthermore the oracle environment is "10.2.0.3".

Configuring the classpath in not something I'm comfortable with - (like anything else I'll back up before doing anything). Is this the correct route to go? Please advise.

Thank you.
Ed Ward
Ranch Hand

Joined: Jan 30, 2006
Posts: 147
You are correct in that classpath is the likely culprit. For compiling though, you do not need to reconfigure anything. Just pass the classpath on the javac command line> javac -cp "pathtofilestoinclude" CLOBFileExample.java

You will need to indentify what jars/libraries to include on the classpath though. I do not recall the filename for the current Oracle drivers libarary, but I use something like ojdbc14.jar
bob reilly
Ranch Hand

Joined: Jan 22, 2007
Posts: 44
I tried that and it intially did not work. I reset the classpath back to its original format.

That said - after reading your response - decided my madness was actually moving in the right direction. In my classpath I added at the end "C:\oracle\product\10.2.0\client_2\jdbc\lib\ojdbc14_g.jar" again.

Tested again and it worked. Is this windows? Reboot your workstation any time you make a change like this?

Don't know but I can go forward with my work here - thank you for responding. It is appreciated!!
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3606
    
  15
bob reilly wrote:Is this windows? Reboot your workstation any time you make a change like this?


You don't need to be quite that extreme. The command prompt picks up any environment variables that are set when it is opened. If you change any of those variables in the System Properties dialog, any open command prompts will not know about those changes. All you had to do was close the command prompt and open a new one.


Joanne
bob reilly
Ranch Hand

Joined: Jan 22, 2007
Posts: 44
Good to know - thank you.
 
GeeCON Prague 2014
 
subject: Package oracle.sql does not exist