jdk1.6.0_14 and OracleXE connection problem

Thread Solved

Join Date: Jul 2009
Posts: 11
Reputation: hims4u is an unknown quantity at this point 
Solved Threads: 0
hims4u hims4u is offline Offline
Newbie Poster

jdk1.6.0_14 and OracleXE connection problem

 
0
  #1
Jul 26th, 2009
hello exprts!! i am new 2 database!!! i have oracleXE and jdk 1.6.0_14 installed on windows XP!! i want 2 connect them via my java program.but i am gettting errors after executing the program.

my code is:

  1. import java.sql.*;
  2. //import oracle.jdbc.*;
  3. //import oracle.jdbc.OracleDriver;
  4.  
  5. public class OracleConnect
  6. {
  7. public static void main(String[] args)throws SQLException
  8. {
  9. try
  10. {
  11. Class.forName("oracle.jdbc.OracleDriver");
  12. //DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
  13. Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@HOST:1521:XE","hr","hr");
  14. if(conn != null)
  15. { System.out.println("I am Connected to oracle database");
  16. }
  17. conn.close();
  18. } catch (Exception e) {
  19. System.out.println("ERROR : " + e);
  20. e.printStackTrace(System.out);
  21. }
  22. }
  23. }
i get the following error:

ERROR : java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at OracleConnect.main(OracleConnect.java:11)

plzz tell me how to solve this problem!!!
Last edited by peter_budo; Jul 26th, 2009 at 7:39 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 11
Reputation: hims4u is an unknown quantity at this point 
Solved Threads: 0
hims4u hims4u is offline Offline
Newbie Poster

Re: jdk1.6.0_14 and OracleXE connection problem

 
0
  #2
Jul 26th, 2009
plzz experts reply!!! i am in deep trouble wid dis one!!!

all other community members !!

plzz giv ur views!!!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,273
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 494
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: jdk1.6.0_14 and OracleXE connection problem

 
-1
  #3
Jul 26th, 2009
There is no need for expert. The error spell it out clearly for you
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
You either do not have connection drivers at all or you did not let application know where to find this driver (either add it through IDE or on compile provide classpath with location of this driver). To download go here
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 11
Reputation: hims4u is an unknown quantity at this point 
Solved Threads: 0
hims4u hims4u is offline Offline
Newbie Poster

Re: jdk1.6.0_14 and OracleXE connection problem

 
0
  #4
Jul 26th, 2009
thanxx for replying but i hav alraedy specified the classpath!!
i hav driver named ojdbc14.jar and ojdbc14_g.jar in E:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib and my classpath is::

E:/oraclexe/app/oracle/product/10.2.0/server/jdbc/lib/ojdbc14.jar;E:\oraclexe\app\oracle\product\10.2.0\server\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Teleca Shared;E:\java\bin

now plzz tell me is the classpath correct???
regarding the drivers plzz specify where shud i find them!!!
i hav them already in /lib as told above!!

plzz reply what shud i do now!!

w8in for ur reply!!
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 11
Reputation: hims4u is an unknown quantity at this point 
Solved Threads: 0
hims4u hims4u is offline Offline
Newbie Poster

Re: jdk1.6.0_14 and OracleXE connection problem

 
0
  #5
Jul 26th, 2009
plzz sumbody help me in dis!!!!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,273
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 494
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: jdk1.6.0_14 and OracleXE connection problem

 
-1
  #6
Jul 26th, 2009
  1. No need to shout with explanation marks, that will not get you faster respond
  2. This is not necessary E:/oraclexe/app/oracle/product/10.2.0/server/jdbc/lib/ojdbc14.jar
  3. ojdbc14.jar or ojdbc14_g.jar will not help you as documentation clearly state "classes for use with JDK 1.4 and 1.5"
  4. Therefore you either need to use lower JDK or get Oracle 11g and download ojdbc6.jar (Classes for use with JDK 1.6.)

Have nice day.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 11
Reputation: hims4u is an unknown quantity at this point 
Solved Threads: 0
hims4u hims4u is offline Offline
Newbie Poster

Re: jdk1.6.0_14 and OracleXE connection problem

 
0
  #7
Jul 26th, 2009
sorry for exclamation marks. i hav downgraded to jdk1.5.0_19 but still the above code does not run. it shows the same error again!!
is dere ne problem wid da code!! plzz tell me.
w8in for ur reply
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,273
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 494
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: jdk1.6.0_14 and OracleXE connection problem

 
-1
  #8
Jul 26th, 2009
Few things you can try
  • If you insisting on using classpath then you should use following declaration E:\Coraclexe\app\oracle\product\10.2.0\server\jdbc\lib
  • On other hand you can direct your IDE where to look for connector, importing JAR for Eclipse here and NetBeans and IntelliJ IDEA here
  • Also check your connection string if @HOST should not be replaced by @localhost, but this is not related to class not found error
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 11
Reputation: hims4u is an unknown quantity at this point 
Solved Threads: 0
hims4u hims4u is offline Offline
Newbie Poster

Re: jdk1.6.0_14 and OracleXE connection problem

 
0
  #9
Jul 28th, 2009
plzz somebody help me.i am still stuck at it!!

plzz mods someone help!!
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,273
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 494
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: jdk1.6.0_14 and OracleXE connection problem

 
-1
  #10
Jul 28th, 2009
Originally Posted by hims4u View Post
plzz somebody help me.i am still stuck at it!!

plzz mods someone help!!
Would be nice if you notified if you tried above recommendations and what happen instead of crying for help.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Oracle Forum


Views: 2501 | Replies: 23
Thread Tools Search this Thread



Tag cloud for Oracle
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC