Re: JDBC for Oracle !

From: Yass Khogaly <ykhogaly_at_us.oracle.com>
Date: Sat, 20 Nov 1999 12:17:47 -0800
Message-ID: <816sal$fve$1_at_inet16.us.oracle.com>


Overview


  This article contains information on how to install the following two   types of JDBC drivers:

  • OCI
  • Thin

  The JDBC OCI driver, as the name suggests, is an OCI based driver. The   JDBC OCI driver uses C entrypoints into the OCI library.

  The JDBC thin driver is entirely java based.

  This article is intended for DBAs or developers who need to install new   versions of the JDBC drivers.

  Installing the JDBC OCI Driver


  Before using the JDBC OCI driver, you must install an appropriate version   of an Oracle client installation that includes SQL*Net, Required Support   Files, and OCI.

  For example, if you wish to use the JDBC OCI 8.1.5 driver, then you must   install an 8.1.5 Oracle client. If you wish to use JDBC on a machine that   has an Oracle database installed, then you need not install an Oracle client.

  For a UNIX Installation:

    Copy the .so file for the driver onto your machine into your     ORACLE_HOME/lib directory. Ensure that this directory is in your     LD_LIBRARY_PATH environment variable.

  For a Windows NT Installation:

    Copy the .dll file for the driver onto your machine into your     ORACLE_HOME\bin directory. Ensure that this directory is in your     PATH environment variable.

  Installing the JDBC Thin Driver


  An Oracle client installation is not required for use of the JDBC   thin driver on the machine where the application or applet runs.

  The JDBC thin driver requires a TCP/IP listener be up and running on the   database machine. The OCI driver requires any listener, not specifically   a TCP/IP listener, to be up and running on the database machine.

  Setting Environment Variables


  For both OCI and thin JDBC drivers, copy the classesxxx.zip onto your   machine. This file contains the java classes for the JDBC drivers and   is named according to the JDK version that it works with. For example,   classes111.zip is for use with the JDK 1.1.x.

  Caution: Do NOT unzip the CLASSESXXX.ZIP FILE.

  If you have an Oracle install (client or database), they can be copied into
  your ORACLE_HOME/jdbc/lib directory. If not, then copy to some directory   on your machine.

  Add the directory, along with the name of the classesxxx.zip file, to your   CLASSPATH environment variable. For example, if you copied the classes111.zip
  file into your ORACLE_HOME/jdbc/lib directory, then you must add   ORACLE_HOME/jdbc/lib/classes111.zip to your CLASSPATH environment variable.

  Add *ONLY ONE* of the zip files in the CLASSPATH.

  If you are using JDBC OCI, ensure that you have ORACLE_HOME/lib/ in your   LD_LIBRARY_PATH environment variable. On Windows NT, ensure that   ORACLE_HOME\bin is in the PATH environment variable. Make sure that you   have the appropriate .so or .dll JDBC OCI file in the directory.

  Testing the JDBC OCI driver


  • Use samples from ORACLE_HOME/JDBC/samples directory. Or, in the case of Oracle 8.1.5, JDBC samples can be found in the demo.zip or demo.tar file located in the ORACLE_HOME/JDBC/demo directory.

  For example:

  • In samples/oci7: jdbcCheckup.java
  • Compile with : javac JdbcCheckup.java
  • Run with : java JdbcCheckup

  Note:

  In order to successfully compile and run the JdbcCheckup application, you   must have a JDK installed for java. You also need to add the JDK zip file(s)
  to your CLASSPATH environment variable. You can obtain a copy of the JDK from
  the following web sites:

    For the latest JDK 1.1.x:

      http://www.java.sun.com/products/jdk/1.1

    For the latest JDK 1.2.x:

      http://www.java.sun.com/products/jdk/1.2

  The output of the program appears as follows like when it is successful:

  Please enter information to test connection to the database   user: scott
  password: tiger
  database (a TNSNAME entry): <a tnsname entry here>   Connecting to the database...Connecting...   connected.
  Hello World
  Your JDBC installation is correct.

  Testing JDBC Thin driver


  • Use samples from ORACLE_HOME/JDBC/samples directory. Or, in the case of Oracle 8.1.5, JDBC samples can be found in the demo.zip or demo.tar file located in the ORACLE_HOME/JDBC/demo directory.

  For example:

  • In samples/thin: Employee.java
  • Edit connect string to reflect user database Connection conn= DriverManager.getConnection ("jdbc:oracle:thin:_at_dlsun511:1521:dbms733","scott","tiger"); | | | machine(ip_at_) : port# : sid
  • Compile with : javac Employee.java
  • Run with : java Employee
  • It prints the ENAME column of the EMP table

"The Views expressed here are my own and not necessarily those of Oracle Corporation"

Eric Chow <eric138_at_yahoo.com> wrote in message news:383620A5.3511C7A5_at_yahoo.com...

> Hi,
>
> Is there any DLL or LIB for Win32 that can be called from Java to
> conenct to Oracle ?
>
> Would you please to tell me where I can get it ?
>
> Best regards,
> Eric
>
Received on Sat Nov 20 1999 - 21:17:47 CET

Original text of this message