Commit e7d5688
Fix Incorrect SQL Type for null Parameters in JDBC Parameter Binding
This PR addresses an issue in the JDBC parameter binding logic where null values were incorrectly being set with Types.VARCHAR SQL type. This behavior could lead to SQL exceptions when inserting null into non-VARCHAR columns in a database. The proposed change ensures that null values are set with Types.NULL, allowing the JDBC driver to correctly interpret the intended type based on the column definition.
Problem Description:
When attempting to insert null values into a database using the Helidon JDBC client, the fixed SQL type of Types.VARCHAR for null parameters leads to type mismatch errors for columns of types other than VARCHAR. For example, inserting null into a NUMERIC column results in a PSQLException with a message indicating a type mismatch.
Proposed Solution:
The fix involves changing the SQL type for null parameters from Types.VARCHAR to Types.NULL in the setParameter method of the JDBC parameter handling logic. This change allows the JDBC driver to determine the correct type for the null value based on the context of the column it is being inserted into, thus preventing type mismatch errors.1 parent 7d5ec7e commit e7d5688
1 file changed
Lines changed: 9 additions & 9 deletions
Lines changed: 9 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
18 | 26 | | |
19 | 27 | | |
20 | 28 | | |
| |||
31 | 39 | | |
32 | 40 | | |
33 | 41 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
0 commit comments