oracle.jdbc.driver.OracleDriver() problem
Hi guys. I am taking a dbsystems class at school. We are required to connect to the schools oracle db using this package: oracle.jdbc.driver
the code provided by the profesor is meant to be used by logging into unix accounts on the schools servers and running our java programs remotely. I've been trying to connect by running the java program localy.
i'm using netbeans 4, with java5. netbeans tells me that this oracle.jdbc.driver package doesn't exist.
here is the connection part of the code:
//create the oracle driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
//create a connection object
Connection conn = DriverManager.getConnection("jdbc:oracle:oci:@<blahblahblah>", "<myusername>", "<mysuperduperprivatepassword>");
I have followed many forums and threads on the web. Most of them seem to be fixed just by renaming the classes12.zip file to .jar, placing them in the jre/lib folder and setting the path, but they all seem to be running the java program on the same computer as the database, where as i'm trying to connect remotely. i still tried following the instructions, and this still hasn't worked for me. so, my question is, will this even work since i am trying to connect remotely? and if not, how can i connect remotely to a database using only java? thanks
gyro
I haven't used NetBeans, but you need to make sure that classes12.zip is in the build path for your project so that NetBeans can find it. NetBeans might include it's own JDK so putting it into another JRE's lib/ext folder not used by NetBeans will not work.
There's no need to convert classes12.zip to a jar. I have used classes12.zip for several years as is when connecting to Oracle 8 databases.
To use the Oracle Call Interface (OCI), you will need to have the Oracle client software installed on the computer where you are running the Java program. You might want to consider changing the URL to use the thin driver unless OCI is the way you are supposed to go.
when you say build path, do u mean the same folder as my .java source? because it is. I don't know if u need to know this, but it will compile, but not run, and then it will print the above mentioned error. but in netbeans, it just tells you ahead of time why it wont run if u try to run it.
anyways, from what i understand from what u wrote, i will need to use the thin driver...now that comes with the oracle.jdbc.driver package, but i just need to use a different call, right? like, instead of oracle.jdbc i would need oracle.thin, is this what u mean? and if it doesn't contain the thin driver, where can i find it? i found it onces before, but that was completely by accident. can someone supply a url? thanks
jay