in reply to Issue with dbi connect_cached method

If you replace connect_cached with connect, does it start working?

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^2: Issue with dbi connect_cached method
by Anonymous Monk on Apr 22, 2022 at 16:55 UTC

    Hi, Choroba
    Thank you for the revert.
    Yes, "connect" seems to be working instead of connect_cached (i tried this before but didn't work, not sure why).
    Instances of "connect" have been replaced with the "connect_cached", long back in the code to improve the performance I guess.
    Please, note that "connect_cached" is causing an issue only for oracle DB whereas it seems to be working for the SQL server.
    Can you please shed some light on this?

    Thank you

      Most likely, the database server has disconnected the database connection and now ->connect_cached tries to reuse the connection but times out. Consider speaking with your database administrator and network administrator after what time the database and the network will drop an existing connection.

      Another problem can be if you use the fork system call. Ideally, DBD::Oracle (and the underlying database library) would detect that and reestablish the connection, but maybe they don't and try to reuse the connection of the parent.

        Thank you Corion for the revert.
        Here lexical scoped variable $dbh has been used (not a global one), so here it should have been created a new connection, isn't it? but somehow it seems to act as a global variable.
        Is there any downside if I retain the "connect" itself instead of "connect_cached", at least for this problematic part of the code.

        Please suggest.
        Regards,