# Zend_Application_Resource_Db

`Zend_Application_Resource_Db` will initialize a `Zend_Db` adapter based on the options passed to it. By default, it also sets the adapter as the default adapter for use with `Zend_Db_Table`.

The following configuration keys are recognized:

- adapter: `Zend_Db` adapter type.

- params: associative array of configuration parameters to use when retrieving the adapter instance.

- isDefaultTableAdapter: whether or not to establish this adapter as the default table adapter.

## Sample DB adapter resource configuration

Below is an example INI configuration that can be used to initialize the DB resource.

    [production]
    resources.db.adapter = "pdo_mysql"
    resources.db.params.host = "localhost"
    resources.db.params.username = "webuser"
    resources.db.params.password = "XXXXXXX"
    resources.db.params.dbname = "test"
    resources.db.isDefaultTableAdapter = true

## Retrieving the Adapter instance

If you choose not to make the adapter instantiated with this resource the default table adapter, how do you retrieve the adapter instance?

As with any resource plugin, you can fetch the DB resource plugin from your bootstrap:

    $resource = $bootstrap->getPluginResource('db');

Once you have the resource object, you can fetch the DB adapter using the `getDbAdapter()` method:

    $db = $resource->getDbAdapter();