Java Program Has Compilation Errors After Upgrade to JDBC Driver 11g (Doc ID 443573.1)

Last updated on AUGUST 03, 2016

Applies to:

JDBC - Version 11.1.0.6 and later
Information in this document applies to any platform.

Symptoms

Some java programs fail to compile after upgrading to JDBC driver 11g. These programs did compile and run successfully with the JDBC 10g driver.

For example, the below code sample will fail to compile and give the following error:

import java.sql.*;
import oracle.jdbc.driver.*;

public class myjdbcapp
{
  public static void main(String[] args) throws SQLException
  {
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    String url = "jdbc:oracle:thin:@server:port:orcl";
    String userName = "scott";
    String password = "tiger";
    Connection conn = DriverManager.getConnection (url, userName, password);
    OracleCallableStatement myprocst  = (OracleCallableStatement)
    conn.prepareCall ("begin myproc(?); end;");
  // ...
  }

}



The above program will fail with following  compiling error:

javac myjdbcapp.java
myjdbcapp.java:13: oracle.jdbc.driver.OracleCallableStatement is not public in oracle.jdbc.driver; cannot be accessed from outside package
    OracleCallableStatement myprocst  = (OracleCallableStatement)
    ^




Changes

Upgrade to 11g JDBC Driver.


Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms