This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "oracle connection problem" Watch "oracle connection problem" New topic

oracle connection problem

sk mehrotra
Ranch Hand

Joined: Oct 27, 2005
Posts: 34
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.*;
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];
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 Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at matt.main(
Plz help me out..


[ 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

Joined: Apr 14, 2004
Posts: 10336

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


Remember, Java is case-sensitive.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: oracle connection problem
It's not a secret anymore!