wood burning stoves*
The moose likes JDBC and the fly likes How to use thin drivers and classes111.zip? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How to use thin drivers and classes111.zip?" Watch "How to use thin drivers and classes111.zip?" New topic
Author

How to use thin drivers and classes111.zip?

honey singh
Ranch Hand

Joined: Apr 26, 2002
Posts: 44
I'm using jdk1.2 and making connection with Oracle8 database using an applet. I resolved the issue
of security by using the policytool. But now I want to know how can I use the Thin Driver to connect with the database?
the code which I had written is :-
import java.sql.*;
try{
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con=DriverManager.getConnection("jdbc racle:thin:@localhost:1521:cbcpeter","scott","tiger");
st=con.createStatement();
}catch(Exception e){System.out.println(e);}

and it gives the following error "Class oracle.jdbc.driver.OracleDriver not found"
So please tell me where to place the classes111.zip or classes12.zip and how to use them?
I had tried with the jdbcodbc driver, but it gives me the error "Cannot load Resource File sqresus.dll"
thanx in advance!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

rename the file to classes111.jar and make sure it is in your classpath. That is all there is too it.
You can use the -cp to set the classpath in the java comamnd if you want.
java -cp c:\mypath\classes111.jar MyJavaClass
and in your code use this instead

The Class.forName is really what you need to change to from your code.
Mark
[ Edited by Dave to clean code and fix smilies ]
[ May 08, 2002: Message edited by: David O'Meara ]

Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
honey singh
Ranch Hand

Joined: Apr 26, 2002
Posts: 44
thanx Mark for the reply,
Actually I'm trying to use jdbc with the applets, so its giving me lot of problems..I cleared the security exceptions using policytool, but now when I tried to use thin driver with the code described previously, then it gives the following exception:
applet not initialized
and java.lang.NoClassDefError: oracle/jdbc/driver/OracleDriver
at userinter.setConnection(userinter.java:370)
at userinter.init(Compiled Code)
at sun.applet.AppletPanel.run(Compiled Code)
at java.lang.Thread.run(Thread.java:479)
where userinter is the name of the class(applet) and setConnection is the name of the method which causes the database connection.
I set the classpath with the following command
set CLASSPATH=.;C:\oracle\ora81\jdbc\lib\classes12.zip;
and use jdk1.2 for this.
Please if you can help!
thanx in advance.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

I am still sticking to my response.
Wether you are using Applets or anything else, you still need to change the name of the file to a .jar, and also use the Class.forName() method to attach to the Driver.
Mark
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by Mark Spritzler:
I am still sticking to my response.
Wether you are using Applets or anything else, you still need to change the name of the file to a .jar, and also use the Class.forName() method to attach to the Driver.
Mark

Mark, it is OK to leave the classpath as he has already done. For some reason, Oracle leaves them in ZIP files which will still work if the classpath is correctly pointing to the zip file. So if your classes12.zip is saved to the directory "C:\oracle\ora81\jdbc\lib\" then the class path is OK. Connection procedure looks fine too. I'm wondering what the "applet not initialized" part of the error message is? At any rate, check and double check that your classes12.zip file is where your classpath says that it is.
Jamie
mustang india
Ranch Hand

Joined: Feb 05, 2002
Posts: 60
Hey,
Instead of pointing to classes12.zip, try using classes111.zip. This should work, I dont know why
Mustang.
honey singh
Ranch Hand

Joined: Apr 26, 2002
Posts: 44
instead of using classes12.zip I had tried classes111.zip also, but that's also not working..
so what else can be done?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to use thin drivers and classes111.zip?
 
Similar Threads
connecting weblogic 6.1 and oracle thru thin driver
JDBC Connectivity
problem with connection
Setting the class path in FORTE 2(CE)
using oracle thin diver, tomcat 5.5.9