Error 17147 With Named Parameters In 11.2 JDBC (Doc ID 1077237.1)

Last updated on AUGUST 03, 2016

Applies to:

JDBC - Version 11.2.0.1 to 11.2.0.1 [Release 11.2]
Information in this document applies to any platform.

Symptoms

Named parameters (formal parameter binding) is not working with Oracle JDBC 11.2.0.1 driver.

For example, a Stored Procedure having the following parameters:
testproc (login IN OUT varchar, pwd IN OUT varchar)

OracleCallableStatement cs =
(OracleCallableStatement)pconnection.prepareCall("begin testproc(?,?);end;");
cs.setString("login", "mylogin");
cs.setString("pwd", "mypwd");

This will now end with the following exception:

SQLState: 99999
Message: Attempt to set a parameter name that does not occur in the SQL:login
Error Code: 17147


The following code confirms that named parameters are supported in 11.2 (this returns true)
DatabaseMetaData dmd = pconnection.getMetaData();
System.out.println("support for named params: " + dmd.supportsNamedParameters());

Changes

Upgrade the Oracle JDBC driver to 11.2.0.1

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