[CONJ-967] clearParameters() breaks validity when using output parameters in stored procedures Created: 2022-04-29 Updated: 2022-05-23 Resolved: 2022-05-13 |
|
| Status: | Closed |
| Project: | MariaDB Connector/J |
| Component/s: | stored procedure |
| Affects Version/s: | 3.0.4 |
| Fix Version/s: | 3.0.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Holger Flörke | Assignee: | Diego Dupin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
If you would like to use output parameters in stored procedures, you have to register these parameters with "registerOutParameter". You do not have to initialize the parameter with a value, because it is a output parameter. If you would like to reuse a stored procedure, a common pattern is to call "clearParameters" to get rid of any input parameter value. After the "clearParameters" you have to set an explicit value for the output parrameter. Otherwise you will get an expception eg "Caused by: java.sql.SQLTransientConnectionException: (conn=5) Parameter at position 2 is not set". That's wrong. |
| Comments |
| Comment by Holger Flörke [ 2022-04-29 ] | |||||||||
|
RegisterOutParameter initialize the Out-Parameter:
ClearParameters will throw away any parameters regardless of in/out:
ValidParameters will check of any parameter regardless of in/out has a value. In my opinion, out-parameters should not be checked in ValidParameters or should be Nulled in ClearParameters. Questions are welcome. I am able to provide a test case... | |||||||||
| Comment by Diego Dupin [ 2022-05-13 ] | |||||||||
|
Thanks for reporting this issue. |