Hi, Gaurav
I think  you're having various problems I suggest ta you take a one by
one aprouch.

1 .- I suggest that you write a simple program to test jour database
connectivity.
something like this (this is my test code, you can use it to try your
hostname,portnumber and dbinstancename values).

import java.io.*;
import java.sql.*;

public class SimpleJDBC
{
 public static void main(String args[]) {
     Connection conn1=null;
     System.out.println("select * from a;");
     try {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        conn1 = DriverManager.getConnection
("jdbc:oracle:thin:@hostname:portnumber:dbinstancename","userid","password"
);
/*   Query table a,  table a has to collumns
        Statement stmt1 = conn1.createStatement ();
        ResultSet rset1 = stmt1.executeQuery ("select * from a");
        while (rset1.next ())
            System.out.println ("ID:"+rset1.getString
(1)+"\tName:"+rset1.getString(2));
*/
     }
     catch (Exception e){
            System.out.println(e.toString());
            e.printStackTrace();
     }
     finally { try { conn1.close(); } catch(Exception e) {} }
 }
}


2.- Driver Loading  (From your code)
     ClassNotFoundException

      try {
            //DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
            Class.forName("oracle.jdbc.driver.OracleDriver");
        }

        catch(ClassNotFoundException e)
        {
        sout.println( "<br>Error Oracle Driver Not Found: " + e + '\t'
);
        }

      *****   Class.forName("oracle.jdbc.driver.OracleDriver");
      This line loads the oracle driver,  if you get get the
ClassNotFoundException you should check your CLASSPATH in order
      to include /usr/local/jdbc/lib/classes.zip  you should get this
part done before you attempt a conect to your database.

3.- Getting a conection (from your code)

     con =
DriverManager.getConnection("jdbc:oracle:thin:@xxxx:portno:yyyy",
"usrname", "pwd");

     xxxxx  is the name of the mahine running your oracledatabase,
     yyyyy is the name of your database,
     port   is the port attended by the listener

    All these depends on your database configuration, your data base
administrator is the person that should know the proper values for
them.

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to