Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

11g->12c java.sql.SQLException: Invalid column index

TPD-OpitzMar 31 2016 — edited Jul 30 2016

Hello,

I have a database application using Java Stored Procedure which is running on a 11g.

I'm about to migrate the application to 12c

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics,

Real Application Testing and Unified Auditing options

ORACLE_HOME = /opt/oracle/product/rdbms/12.1.0

System name:    Linux

Release:    3.10.0-327.el7.x86_64

Version:    #1 SMP Thu Oct 29 17:29:29 EDT 2015

Machine:    x86_64

but on the new database the code starts to throw

java.sql.SQLException: Invalid column index

This is the the code causing the problem:

  1. sqlStatement = "select fk from table where pk = ?";
  2. PreparedStatement pstmt = getConnection().prepareCall(sqlStatement);
  3. pstmt.setBigDecimal(1, idPassedAsMethodParameter);
  4. ResultSet rs = pstmt.executeQuery();

The problematic code is really this simple! It is located in a public static Method.

Why does 12c refuse to work with this code?

bye

TPD

This post has been answered by TPD-Opitz on Jul 30 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2016
Added on Mar 31 2016
4 comments
5,551 views