Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to register CallableStatement out parameter #1646

Closed
torrejonv opened this issue Dec 13, 2019 · 1 comment
Closed

Unable to register CallableStatement out parameter #1646

torrejonv opened this issue Dec 13, 2019 · 1 comment

Comments

@torrejonv
Copy link

@torrejonv torrejonv commented Dec 13, 2019

I'm submitting a ...

  • [X ] bug report

Describe the issue
A clear and concise description of what the issue is.

Driver Version?
42.2.9

Java Version?
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)

OS Version?
CentOS 7.6

PostgreSQL Version?
11.6

To Reproduce
Steps to reproduce the behaviour:

Error seen after upgrading to 42.2.9. No error seen with 42.2.8.

Attempts to register an Out callable parameter do not work. See example code (confidential bits masked out) and error:

    CallableStatement cs = null;
    Connection conn == null;
    ResultSet rs = null;

    try {

        conn = getConnection();
        cs = conn.prepareCall("{ ? = call xxxx.yyyy (?,?,?,?)}");

        cs.registerOutParameter(1, Types.REF_CURSOR);

        cs.setLong(2, aaaa);
       
        cs.setLong(3, bbb);
        

        cs.setLong(4, cccc);
       
     
        cs.setNull(5, Types.NUMERIC);

Exception thrown at the last step:

Caused by: org.postgresql.util.PSQLException: The column index is out of range: 5, number of columns: 4.”
78: ” at org.postgresql.jdbc.PgPreparedStatement.setNull(PgPreparedStatement.java:188)”

Somehow the out parameter is not registering properly now. Works well in the previous 42.2.8 (and other previous releases). If syntax of the SQL needs to change anyhow, please advise.

@davecramer
Copy link
Member

@davecramer davecramer commented Dec 13, 2019

fixed with #1648

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants