| | |
java runtime error for database connection
![]() |
•
•
Join Date: Dec 2007
Posts: 1
Reputation:
Solved Threads: 0
hi all
i was installed jdk1.5 and oracle 10g.
i got a runtime error like this.
i want to compile and run the same program in command prompt and eclipse also .
import java.sql.*;
public class Oapp2
{
public static void main(String args[])
{
try{
Class.forName("oracle:jdbc:driver:OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin
localhost:1521:xe","scott","tiger");
System.out.println("connected");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
i got an same error in editplus and eclipse as following.
java.lang.ClassNotFoundException: oracle:jdbc:driver:OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at Oapp2.main(Oapp2.java:11)
plese help me.
i was installed jdk1.5 and oracle 10g.
i got a runtime error like this.
i want to compile and run the same program in command prompt and eclipse also .
import java.sql.*;
public class Oapp2
{
public static void main(String args[])
{
try{
Class.forName("oracle:jdbc:driver:OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin
localhost:1521:xe","scott","tiger");System.out.println("connected");
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
i got an same error in editplus and eclipse as following.
java.lang.ClassNotFoundException: oracle:jdbc:driver:OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at Oapp2.main(Oapp2.java:11)
plese help me.
You haven't included the jarfile containing the Oracle JDBC Driver on the classpath.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
>
Class.forName("oracle:jdbc:driver:OracleDriver"); There is no class which goes by the name of oracle:jdbc:driver:OracleDriver . Replace those : with . and you should be fine provided you have included the classes12.jar or some other thin oracle driver in your classpath. I don't accept change; I don't deserve to live.
Ha. ;-)
Din't really look at the class name. These classpath questions (at least because of other forums) have simply become knee-jerk reactions. ;-)
Din't really look at the class name. These classpath questions (at least because of other forums) have simply become knee-jerk reactions. ;-)
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
Similar Threads
- This is a wierd one! (Windows NT / 2000 / XP)
- Problem with database connection (JSP)
- Please help me in connecting JSP to MySql (JSP)
- URGENT: JSP - StackOverFlow Error (JSP)
- Hijackthis report, I just don't know (Viruses, Spyware and other Nasties)
- Problem connecting my Tomcat Server and MySQL using JSP (JSP)
- problem in installing jdbc... (Java)
- Zone Alarm Security Alerts. (Viruses, Spyware and other Nasties)
- Aurora/drpmon.dll - assistance needed (Viruses, Spyware and other Nasties)
Other Threads in the Java Forum
- Previous Thread: class cast exception
- Next Thread: Components
| Thread Tools | Search this Thread |
account android applet application apps array automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error eventlistener exception expand fractal free game givemetehcodez graphics gui guidancer homework html ide image inheritance integer integration intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jlabel jme jni jpanel jtextfield jtree julia linux loop method midlethttpconnection migrate mobile mobiledevelopmentcreatejar monitoring myaggfun netbeans newbie nullpointerexception open-source oracle plazmic print problem program property ria scanner server set sharepoint smart sms smsspam sourcelabs splash sql sqlite subclass support swing testautomation textfield threads tree trolltech unlimited utility windows






