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

Eric Hanson elh at cs.pdx.edu
Thu Mar 8 00:28:33 UTC 2007


On Tue, 2007-03-06 at 19:57 -0800, Dave Beckett wrote:
> 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.

Right now it doesn't use find_statement, instead it uses
librdf_query_results_get_binding_name and
librdf_query_results_get_binding_value.  Maybe it should be?  The
library is attached, maybe you could just look it over and point out
whatever I'm doing that's stupid and wrong? :-)  I'm trying to capture
the best behavior for the most common usage scenarios, and make that as
fast and easy as possible.

Questions include:
1. How do fix the too many mysql connections errors?
2. How do I get access to Redland error messages on failure?
3. Are there better (more performant, cleaner, etc) ways of doing
things, maybe by using streams?

Thanks,
Eric


-------------- next part --------------
A non-text attachment was scrubbed...
Name: redland.php
Type: application/x-php
Size: 6543 bytes
Desc: not available
Url : http://lists.usefulinc.com/pipermail/redland-dev/attachments/20070307/75ebc9ba/redland.bin


More information about the redland-dev mailing list