http://qs1969.pair.com?node_id=429015


in reply to Using fork with DBI to create simultaneous db connections.

Each child must have its own connection to the database as the DBD (and possibly the database system) stores data in process-local storage. The poor database system will be very confused when it get requests from different processes in the same connection - each having possibly a different view of the state of the connection. The results are highly unpredictable, time and usage dependent and will cause your hair to fall out and your teeth to rot.

Either let each child have its own connection, or have a common process (eg the 'mother') handle all the database traffic, and use something else to communicate with this 'db-server-process', some sort of RPC or shared memory or... YMMV.

Just don't (repeat DON'T) share database connections between processes.

Did I remember to say that you should not share connections between processes?