My Oracle Support Banner

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

Last updated on SEPTEMBER 24, 2019

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:@//<HOST>:<PORT>/<SERVICE_NAME>";
    String userName = "<USER>";
    String password = "<PASSWORD>";
    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

To view full details, sign in with your My Oracle Support account.

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


In this Document
Symptoms
Changes
Cause
Solution
References

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.