aspose file tools*
The moose likes JDBC and the fly likes oracle connection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "oracle connection problem" Watch "oracle connection problem" New topic
Author

oracle connection problem

sk mehrotra
Ranch Hand

Joined: Oct 27, 2005
Posts: 34
hi..
i am using windows xp pro, Oracle 10g and jdk1.5.
I am not able to connect to database through java program.

Code is below:

import java.sql.*;
import java.io.*;
public class matt
{
public static void main(String args[])
{
String uid=args[0];
String pwd=args[1];
String name=args[2];
String age=args[3];
String qty=args[4];
String phno=args[5];
String secq=args[6];
String seca=args[7];
try
{
Class.forName("Oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc: oracle:thin:@matt:1521","scott","tiger");
Statement stmt=con.createStatement();
int i=stmt.executeUpdate("insert into reg values('"+uid+"','"+pwd+"','"+name+"',"+age+","+qty+","+phno+",'"+secq+"','"+seca+"')");

System.out.println("record updated:"+i);
}
catch(Exception e)
{ e.printStackTrace(); }
}
}


Error is::

The error i am getting is ::
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 matt.main(matt.java:17)
Plz help me out..

Thanks//

[ February 07, 2006: Message edited by: sk mehrotra ]

[ February 07, 2006: Message edited by: sk mehrotra ]

[ February 07, 2006: Message edited by: sk mehrotra ]

[ February 07, 2006: Message edited by: sk mehrotra ]

[edited subject to make meaningful - was "Help Me plz..."]
[ February 07, 2006: Message edited by: Jeanne Boyarsky ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'm assuming it something to do with the driver package name you are using:

Oracle.jdbc.driver.OracleDriver

Remember, Java is case-sensitive.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
 
wood burning stoves
 
subject: oracle connection problem