• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How to use thin drivers and classes111.zip?

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
honey singh
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey,
Instead of pointing to classes12.zip, try using classes111.zip. This should work, I dont know why
Mustang.
 
honey singh
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
instead of using classes12.zip I had tried classes111.zip also, but that's also not working..
so what else can be done?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic