Re: 4.1 informix jdbc issue

Sébastien Pérès-Labourdette <[email protected]>
Newsgroups gmane.comp.java.cayenne.user
Organization Groupe omerin
Message-ID <[email protected]>
Hi Hugi

Thanks for sharing this "not so ugly at all" workaround.
Upgrading the server side (Informix SE 7.25.UC7 on IBM AIX 5.3) not
being an option as well, we'll try something in that direction.

Thanks again.

--
Sébastien

------------------------------------------------------------------------
*De : *Hugi Thordarson <[email protected]>
*Envoyé : * Jeudi 10 Septembre 2020 21:00:38
*À : *User <[email protected]>
*Objet : *Re: 4.1 informix jdbc issue
> Hi Sébastien,
>
> Do you have the option of upgrading the Informix JDBC-driver? I seem to recall that their more recent drivers *do* support prepareStatement(String,int) but to use a newer JDBC driver you need a compatible version of Informix (can't use the new JDBC-drivers to connect to older versions of the DB). We couldn't do that—all the people that knew the DB server were either dead or retired—but if that's possible in your case, that would probably be the best solution.
>
> ---- Story of an ugly workaround starts. Do not read if you are young, impersonable or mentally unstable. In fact, probably just don't read this at all.
>
> But yes, I encountered this issue a couple of years ago and I didn't really solve it. Cayenne 4.1+ will use prepareStatement( String, int ) if the table has a DB-generated PK column. In my case, the non-solution I ended with was make the generated PK "Cayenne generated". Then I implemented a PKGenerator that just returned "null" for the PK. Then I excluded the PK-column from insert statements using an InsertBatchTranslator (because Informix would not populate the PK/serial's value if it was set to null in the insert statement). Then I just threw away the poor ObjectContext that did all these horrible things and re-fetched the inserted objects in a new context, now with DB generated PKs.
> This is obviously horrid. But it worked as a temporary workaround while we were in the process of migrating to Postgres.
>
> ---- Ugly workaround ends
>
> So in short: I hope you can upgrade the JDBC driver. Or that I am in the wrong and someone has a better solution for you.
>
> - hugi
>
>
>
>> On 10 Sep 2020, at 10:24, Sébastien Pérès-Labourdette <[email protected]> wrote:
>>
>> Hi there.
>>
>> While integrating 4.1 we found that the informix jdbc driver from ibm
>> does not support
>> IfxSqliConnection:prepareStatement(String,int)
>>
>> Invoked from
>> connection.prepareStatement(compiled.getSql(), generatedKeys); in
>> SQLTemplateAction.execute
>>
>> FYI,4.0.2 sqltemplates are fine with this jdbc driver.
>>
>> Is there anything we can do (replacing informix with any other rdbms not
>> being an option) to get 4.1 sqltemplates running as smooth as the 4.0.2
>> ones ?
>>
>> --
>> Sébastien
>>
signature.asc (application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEznMZYIYm11GH+LgZbWUMMqvegosFAl9bHioACgkQbWUMMqve
gov0VAf/cqF/rJDr6mVuhqWrKGYWkTNJbxc0eKlay72uTUS7cRgeeB8FP+w2Pe8t
7WtEBA7JZzoWPwCVrRWTpYNlhuZ4teVNCCAaCIXS7rUNbmevdKVdXZgXWdVRV6Iy
QAVQni0VL5y2Fzp8kzcJNSEWPx0HSf6qC8Wpu/JNnqvf4k4TIMSTwTio2YHWKBFa
MRjKX9VksaeUpK19sEnZbBlqMaaM40jAFUKiOFEse4WjaIRjwbPgUqA2/noR7BUr
JoXyvLf2aYE8k0kYzGQ9imdJgsjvmK2w+88J4YjfU23inVO1gRYacwEZHWSdFI6f
lLKcJ+dBwmu95DpzCG1eoUStg3ksCg==
=6Uw/
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.