//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();
...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 for the response...but I thought the classes12.zip was for the java 1.3 version and ojdbc14.jar was for java 1.4.2?
Also, I got it to work in Netbeans by mounting an archive and then pointing to the ojdbc14.jar file, however, how would one compile and run this from the command line if the only way for it to work is to import these files into your project?
Yes and no. Classes12.jar work well in Java 1.1 and above environment, but ojdbc14.jar is ONLY for Java 1.4x. But since your default JRE is of version 1.3.1, your code wouldn't run even if you would get it compiled with your Java 1.4.1_03 SDK. That's why I used classes12 in my example.
Furthermore, the interface of both jars is the same, so instead of classes12.jar include ojdbc14.jar in above example. No code modification needed.
So how do you compile and run the program in a "stone age style"?
It's a nice little tool, free, about 80 Megs with all important features, no installation needed. And you don't need a P4 3.0 with 1GB RAM to run it. It's suitable for beginners, no need to be heavy-duty Java programmer.
I love deadlines. I especially like the whooshing sound they make as they go
flying by. (c)Dilbert
I also was trying to depoly a simple JSP page with a SQL call to an oracle instance, but I keep getting the "package oracle.jdbc does not exist" or simiar errors.
I used Eclipse IDE and deployed to Tomcat server, which I thought might be the problem, so I downloaded and installed Sun's Glassfish server. The same problem persisted.
I followed instructions/advice and added the file C:\oracle\product\10.2.0\db_1\jdbc\lib\classes12.jar to my build path. Would not work.
Finally, I happened to notice a warning from eclipse:
"Classpath entry C:/oracle/product/10.2.0/db_1/jdbc/lib/classes12.jar will not be exported or published. Runtime ClassNotFoundExceptions may result."
If you see this warning, right mouse it and choose Quick Fix - a dialog offers two quick fixes, the first one will be:
"Mark the associated raw classpath entry as publish/export dependency."
With this option highlighed click Finish - this will remove the warning and resolve this problem.
Once I did that my jsp page worked correctly in either Tomcat or Glassfish. I tried it on several other projects and it also worked.
Bookmarks