File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting Invalid Package Error while connecting to Oracle

 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am using oracle 8.1.7 and using tomcat as web server.I downloaded classes12.zip from oracle website.I converted the zip file to jar file and placed the jar file in tomcat root directory\shared\lib folder.I also set the classpath for the jar file(to above path).I am getting Invalid path error when i compile a java file.The Code is given below.

The error i got is
package oracle.jdbc.driver does not exist
Help me please..Urgent

Regards
Vasu
 
Wayne L Johnson
Ranch Hand
Posts: 399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is definitely a classpath issue. You say you "converted" the ZIP to a JAR file. Did you simply rename it (which is the correct thing to do), or did you do something else? If you did something else, you might want to open the JAR file and make sure the classes and paths (packages) are OK.
If everything in the JAR file seems to be OK, then it means your classpath is set wrong. That what the error means.
As a secondary point, you should NOT include the "DriverManger.registerDriver(...)" call in your code; it will be done for you as part of the "Class.forName(...)".
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a secondary point, you should NOT include the "DriverManger.registerDriver(...)" call in your code; it will be done for you as part of the "Class.forName(...)".
I would have said 'Firstly, ...' Please don't do this! Class.forName() will do this for you - a Driver is required to register itself when the class is loaded.
I'm confused why the Class.forName() appears to work, but the DriverManager call does not. Anyway, I usually recommend dropping the jar in the webapp/WEB-INF/lib directory rather than a common global directory.
Dave
 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I extracted the zip file to a folder and agained zipped and gave name as classes12.jar.
Regards
Vasu
 
Ram Mohan
Ranch Hand
Posts: 44
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Wayne L Johnson:
It is definitely a classpath issue. You say you "converted" the ZIP to a JAR file. Did you simply rename it (which is the correct thing to do), or did you do something else? If you did something else, you might want to open the JAR file and make sure the classes and paths (packages) are OK.

vasu, obviously you shouldn't zip the files like Wayne pointed out...though winzip can read jar files, it doesn't mean jar files & zip files are the same....you can always use the jar creator that comes along with java for creating jar files
 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After i converted to zip file to jar file i tested it by extracting the jar file to a folder using winzip and it has all the folders and files which is there in classes12.zip .
Vasu
 
Vasudevan Gopalan
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I downloaded classes12.zip for oracle 8.1.7 for jdk 1.2.x.But i am using jdk 1.4.2.I dont know whether this can be a problem.

Vasu
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic