tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Goehring, Chuck Mr., RCI - San Diego" <cgoehr...@resourceconsultants.com>
Subject RE: java + oracle question ?
Date Tue, 21 Jan 2003 19:56:08 GMT
sufi

To get them to work, I had to rename them for .zip to .jar and put them in the javaxxx\jre\lib\ext
directory.

Chuck

-----Original Message-----
From: sufi malak [mailto:sufi_m@hotmail.com]
Sent: Tuesday, January 21, 2003 11:52 AM
To: EJB-INTEREST@JAVA.SUN.COM; james@jsptags.com;
JSP-INTEREST@JAVA.SUN.COM; servlet-interest@java.sun.com;
taglibs-user@jakarta.apache.org
Subject: java + oracle question ?



I have installed oracle 8i in windows2000, and have a java class to connect 
to the oracle database, compiled it but when run it I got an exception :
oracle.jdbc.driver.OracleDriver
Question : Do I need to download a driver for oracle or it comes with the 
instatllation ??

Here is the code :

import java.sql.*;
public class JDBCExample {
  public static void main(String[] args) {
    try {
      Class.forName("oracle.jdbc.driver.OracleDriver");
      Connection conn = DriverManager.getConnection(
        "jdbc:oracle:thin:@majid:1521:test",
        "scott", "tiger");
      System.out.println("Got connected");
      int maxEmpNo = 7600;

      //Create PreparedStatement
      String s = "SELECT e.ename, e.job, d.dname "
        + "FROM emp e, dept d "
        + "WHERE e.deptno = d.deptno "
        + "AND e.empno < ?";
      PreparedStatement stmt = conn.prepareStatement(s);
      stmt.setInt(1, maxEmpNo);
      ResultSet rs = stmt.executeQuery();

      System.out.println("Name" + "\t" + "Job" + "\t" + "Department");
      while (rs.next()) {
        System.out.println(rs.getString("ename") + "\t"
          + rs.getString("job") + "\t"
          + rs.getString("dname"));
      }
    } catch (Exception e) {
      System.out.println(e.getMessage() );
    }
  }
}


Thanks






_________________________________________________________________
MSN 8: advanced junk mail protection and 2 months FREE*. 
http://join.msn.com/?page=features/junkmail


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message