in reply to Global dbh and inserts

Hi,

it depends on the worker model you use with Apache.

When you use the forking model than every child of the Apache master process should create a database handle as every request gets handled by one child. The request->do-something on the database->return-response-cycle should be safe. In this scenario you only have to be sure that each cycle is terminated by a correct commit or rollback. It would be bad if you open a transaction with one request and close it with another.

When you use the threading model in Apache it gets IMHO more problematic. You have to synchronize the access to a global DBI handle and you have to be sure (as above) that ONE transaction is not used by several requests.

I just looked at the docs of Apache::DBI explaining the same in more detail.

Best regards
McA