Zend_Db::factory() produces a Zend_Db_Adapter for you to work with but the
Zend_Db_Adapter will only create a connection when it needs to (first
request, this is known as "lazy-loading").
So, if you want to manage "connection" timeouts, (lets assume PDO for this),
this is something you'd have to pass into the "driver_options" section of
the config. You would be looking for a attribute like "ATTR_TIMEOUT" or
something to that effect if I recall correctly.
You'd want to consult the PDO pages of php.net to ensure this, and if you
are using a different adapter, the manual pages for that adapter, as these
are driver specific options.
Also, to effectively enforce this, you'd have to call
$dbAdapter = Zend_Db::factor(..);
$dbAdapter->getConnection();
To start the connection after adapter creation.
-ralph
On 1/5/09 5:01 PM, "block.jon" <jblock@hotornot.com> wrote:
>
> How do I set my connection timeout when I create an adapter?
>
> Here's what I've got now....
>
> $adapterToAdd = Zend_Db::factory($zend_db_config);
>
> I want it to fail if it doesn't get a connection within 15 seconds. The
> default seems to be 30 seconds.
>
> Thank you!!
> Jon
--
Ralph Schindler
Software Engineer | ralph.schindler@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论