Verifying the Oracle Database 12c Release 2 (12.2) Installation

Oracle Database 12c Release 2 (12.2) installation is platform-specific. You must verify that the installation was successful before you proceed to create the sample application. This section describes the steps for verifying an Oracle Database 12c Release 2 (12.2) installation.

Verifying a installation involves the following tasks:

Checking Installed Directories and Files

Check if the directories described in the following table have been created and populated in the ORACLE_HOME directory.

Table 2-1 Directories and Files in the ORACLE_HOME Directory

Directory Description

$OH/jdbc/lib

The lib directory contains the ojdbc8.jar file and required Java classes. The ojdbc8.jar file contains the JDBC driver classes for use with JDK 8.

$OH/jdbc/Readme.txt

This file contains late-breaking and release-specific information about the drivers, which may not have been included in other documentation on the product.

$OH/jlib

This directory contains the orai18n.jar file. This file contains classes for globalization and multibyte character sets support.

Note:

Use the ojdbcn.jar file (where 'n' is the release number) supplied with Oracle Database Installation Guide or Oracle Database Client Installation Guide.

Checking the Environment Variables

This section describes the environment variables that must be set for the JDBC Thin Driver. You must set the classpath for your installed JDBC Thin Driver. For JDK 8, you must set the following values for the CLASSPATH variable:

  • ORACLE_HOME/jdbc/lib/ojdbc8.jar
  • ORACLE_HOME/jlib/orai18n.jar

Ensure that there is only one JDBC class file, such as ojdbc8.jar, and one globalization classes file, orai18n.jar, in the CLASSPATH variable.

Determining the JDBC Driver Version

Starting from Oracle Database 12c Release 2 (12.2), you can get details about the JDBC support in the database as follows:

> java -jar ojdbc6.jar
  Oracle 12.1.0.0. JDBC 4.0 compiled with JDK6

In addition, you can determine the version of the JDBC driver that you installed by calling the getDriverVersion method of the OracleDatabaseMetaData class.

Note:

The JDBC Thin Driver requires a TCP/IP listener to be running on the computer where the database is installed.

Example 2-1 illustrates how to determine the driver version:

Example 2-1 Determining the JDBC Driver Version

import java.sql.*;
import oracle.jdbc.*;
import oracle.jdbc.pool.OracleDataSource;

class JDBCVersion
{
  public static void main (String args[]) throws SQLException
  {
    OracleDataSource ods = new OracleDataSource();
    ods.setURL("jdbc:oracle:thin:hr/hr@localhost:1521/oracle");
    Connection conn = ods.getConnection();

    // Create Oracle DatabaseMetaData object
    DatabaseMetaData meta = conn.getMetaData();

    // gets driver info:
    System.out.println("JDBC driver version is " + meta.getDriverVersion());
  }
}