Informix

 View Only

 Migration from Informix 9 to Informix 15, JDBC Problem with float in prepared statements

Andreas Ittgenshorst's profile image
Andreas Ittgenshorst posted Wed February 26, 2025 08:41 AM

Hi,


we are currently using an Informix 9 server and would like to switch to Informix 15. We have a problem when using prepared statements with the data type float via JDBC. The new server behaves differently and does not deliver the expected result.

Informix 9:
String query = "select 2.0 * ? as result from dsfco";    <- Result: 0.00748000014573336  OK
String query = "select 2 * ? as result from dsfco";      <- Result: 0.00748000014573336  OK

Informix 15
String query = "select 2.0 * ? as result from dsfco";    <- Result: 0.00748  OK
String query = "select 2 * ? as result from dsfco";      <- Result: 0        BAD

Informix 15, InformixHQ SQL Tracing: select 2.0 * ? as result from dsfco 
Host Variables
Position    Type    Value
0    decimal    0.00374

Informix 15, InformixHQ SQL Tracing: select 2 * ? as result from dsfco
Host Variables
Position    Type    Value
0    integer    0

I assume that since 2 is an integer, 0.00374 is converted to integer 0. Why does the new server behave differently and what options do I have to fix this?