[redland-dev] too many connections to mysql from php

Dave Beckett dave at dajobe.org
Wed Mar 7 03:57:22 UTC 2007


Eric Hanson wrote:
>>From the PHP API how do I close the MySQL connection?  I'm getting "too
> many connections" in my Apache logs after issuing a few queries.  Also,
> how does synchronization work (the _sync_ methods) and when is it necessary?

It should happen automatically when the store is closed.

Each time you do a find_statement() against a sql model, creating a stream,
it makes a SELECT against the database with one connection.  If you forget
to destroy the stream, that connection will remain open and not reused.
If you do close/destroy the stream, the connection can be returned to
the pool and reused.  Similarly inside a query SPARQL/RDQL, each triple
pattern turns into a find_statement() and one SELECT.

Sync's not needed.

Incidently in SVN there are transactions added to the mysql store
and a new transaction API to use it.

Dave


More information about the redland-dev mailing list