-
Error: "package oracle.jdbc does not exist"
Hello,
I'm trying to write a simple Java example that pulls from an Oracle Database, however, I keep getting this error when I try to compile it.
-----------------------------------------------------------------
Test/FirstExample.java [22:1] package oracle.jdbc does not exist
Class.forName(oracle.jdbc.driver.OracleDriver);
^
1 error
Errors compiling FirstExample.
-----------------------------------------------------------------
Here's what my classpath is set to:
CLASSPATH=.;D:\Oracle\ora92\jdbc\lib\ojdbc14.jar;D:\Oracle\ora92\jdbc\lib\ocrs12.zip
Here's what my path is set to:
PATH=D:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program
Files\Oracle\jre\1.1.8\bin;C:\j2sdk1.4.2_04\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Syst em32\Wbem
Here's what my Java_home is set to:
JAVA_HOME=C:\j2sdk1.4.2_04
Here's what my oracle_home is set to:
ORACLE_HOME=D:\Oracle\ora92
I'm using the 1.4.2 Java SDK and I'm running the Oracle Server on the same box
that I'm developing on (no Oracle client is installed)
Here is my code:
------------------------------------------------------------------------
package Test;
import java.sql.*;
public class FirstExample {
public static void main(String[] args){
//declare Connection and Statement Objects
Connection myConnection = null;
Statement myStatement = null;
try{
//register the Oracle JDBC drivers
Class.forName(oracle.jdbc.driver.OracleDriver);
//create a connection object, and connect to the database as system
//using the oracle JDBC Thin driver
myConnection = DriverManager.getConnection("jdbc:oracle:thin@dev:1521:ORACLASS", "system", "password");
//create a statement object
myStatement = myConnection.createStatement();
ResultSet myResultSet = myStatement.executeQuery("SELECT user, sysdate " +
"FROM dual");
...deleted rest of script
-----------------------------------------------------------------------------
I know that package exists on my computer because I can find it in windows explorer. I also noticed when i tried to use the OracleDataSource class, I pretty
much got the same error. Again, I can find the class in Windows Explorer, so I know it's there. I thought I had the CLASSPATH set right, however, now I have
no clue what's going on. Please help, any help would be
greatly appreciated.
Thanks in advance,
ChrisClass.forName(oracle.jdbc.driver.OracleDriver);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|