Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

oracle connection problem

 
sk mehrotra
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm assuming it something to do with the driver package name you are using:

Oracle.jdbc.driver.OracleDriver

Remember, Java is case-sensitive.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic