File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Getting Invalid Package Error while connecting to Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Getting Invalid Package Error while connecting to Oracle" Watch "Getting Invalid Package Error while connecting to Oracle" New topic
Author

Getting Invalid Package Error while connecting to Oracle

Vasudevan Gopalan
Ranch Hand

Joined: Aug 29, 2003
Posts: 67
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

Joined: Sep 03, 2003
Posts: 399
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

Joined: Mar 06, 2001
Posts: 13459

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

Joined: Aug 29, 2003
Posts: 67
I extracted the zip file to a folder and agained zipped and gave name as classes12.jar.
Regards
Vasu
Ram Mohan
Ranch Hand

Joined: Jan 19, 2004
Posts: 44
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


If quitters never win, and winners never cheat, who's the idiot that said: Quit while you're ahead?
Vasudevan Gopalan
Ranch Hand

Joined: Aug 29, 2003
Posts: 67
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

Joined: Aug 29, 2003
Posts: 67
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting Invalid Package Error while connecting to Oracle