• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting Invalid Package Error while connecting to Oracle

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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(...)".
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I extracted the zip file to a folder and agained zipped and gave name as classes12.jar.
Regards
Vasu
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic