[CONJ-1012] stored procedure register output parameter as null if set before registerOutParameter command Created: 2022-09-19  Updated: 2022-12-22  Resolved: 2022-09-19

Status: Closed
Project: MariaDB Connector/J
Component/s: stored procedure
Affects Version/s: None
Fix Version/s: 3.0.9, 3.1.0

Type: Bug Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

When using a store procedure with in and out parameters, if parameter is set BEFORE registering parameter as an output parameter, it will be sent as NULL to server.
example :

        cstmt = connection.prepareCall(sql);
        cstmt.setLong(1, 42L);
        cstmt.registerOutParameter(1, Types.NUMERIC);
        cstmt.executeQuery();

as a workaround, registering parameter before setting value has correct behavior:

        cstmt = connection.prepareCall(sql);
        cstmt.registerOutParameter(1, Types.NUMERIC);
        cstmt.setLong(1, 42L);
        cstmt.executeQuery();


Generated at Thu Feb 08 03:19:58 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.