in reply to Best practices for closing database connections?
> Should the connection be explicitly closed? and if so, should some command, e.g. "commit", be given first? Should a single connection be opened, and all queries funneled through that before closing it (and the script itself)?
In my limited experience I saw disconnect as soon as possible, obviously after having committed your transactions (there is also autocommit available). And yes, one single connection as suggested by wiser hippo.
Tricks with DBI is still worth to read after (ugh!) 22 years, as The fine art of database programming, Databases made easy and notably DBI recipes by our sleeping brother gmax
PS from Programming the Perl DBI
> Explicit disconnection from the database is not strictly necessary if you are exiting from your program after you have performed all the work, but it is a good idea. We strongly recommend that you get into the habit of disconnecting explicitly.
L*
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Best practices for closing database connections?
by Polyglot (Chaplain) on Mar 17, 2022 at 11:28 UTC | |
by hippo (Archbishop) on Mar 17, 2022 at 12:19 UTC | |
by Polyglot (Chaplain) on Mar 17, 2022 at 12:43 UTC | |
by soonix (Chancellor) on Mar 17, 2022 at 13:31 UTC | |
by Polyglot (Chaplain) on Mar 17, 2022 at 13:52 UTC | |
| |
by marto (Cardinal) on Mar 17, 2022 at 13:19 UTC | |
by Polyglot (Chaplain) on Mar 17, 2022 at 14:06 UTC | |
| |
by erix (Prior) on Mar 17, 2022 at 13:06 UTC | |
by Polyglot (Chaplain) on Mar 17, 2022 at 13:56 UTC | |
|