Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2003
    Location
    Los Alamos/Santa Fe, NM
    Posts
    69

    Unanswered: Java thin driver on Oracle9i

    What is the syntax for Oracle9i Java thin driver? Is it the same as 8i, because I cannot get 9i thin driver to work.

    I got the OCI to work but Oracle 9i's OCI seems slower than Oracle 8i's OCI. Any comments?
    Michellea Southern-David

  2. #2
    Join Date
    Apr 2003
    Location
    Los Alamos/Santa Fe, NM
    Posts
    69

    got it

    The Oracle JDBC driver was changed from Oracle.jdbc.driver.OracleDriver to Oracle.jdbc.OracleDriver .

    to call the thin driver:
    http://download-west.oracle.com/docs...6654/basic.htm

    Import Packages
    Regardless of which Oracle JDBC driver you use, include the following import statements at the beginning of your program (java.math only if needed):

    import java.sql.*; for standard JDBC packages

    import java.math.*; for BigDecimal and BigInteger classes


    Import the following Oracle packages when you want to access the extended functionality provided by the Oracle drivers. However, they are not required for the example presented in this section:

    import oracle.jdbc.*;

    import oracle.sql.*; for Oracle extensions to JDBC

    Register the JDBC Drivers
    You must provide the code to register your installed driver with your program. You do this with the static registerDriver() method of the JDBC DriverManager class. This class provides a basic service for managing a set of JDBC drivers.

    DriverManager.registerDriver (new oracle.jdbc.OracleDriver());


    Open a Connection to a Database
    Open a connection to the database with the static getConnection() method of the JDBC DriverManager class.

    getConnection(String URL, String user, String password);

    Where the URL is of the form:
    jdbcracle:<drivertype>:@<database>


    The following example connects user scott with password tiger to a database with INSTANCE_NAME orcl through port 1521 of host myhost, using the Thin driver.

    Connection conn = DriverManager.getConnection
    ("jdbcracle:thin:@myhost:1521rcl", "scott", "tiger");


    If you want to use the default connection for an OCI driver, specify either:

    Connection conn = DriverManager.getConnection
    ("jdbcracleci:scott/tiger@");

    or:

    Connection conn = DriverManager.getConnection
    ("jdbcracleci:@", "scott", "tiger");


    If you want to connect with the Thin driver, you must specify the port number and SID. For example, if you want to connect to the database on host myhost that has a TCP/IP listener up on port 1521, and the SID (system identifier) is orcl:

    Connection conn = DriverManager.getConnection
    ("jdbcracle:thin:scott/tiger@myhost:1521rcl);
    Michellea Southern-David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •