There seem to be many ways to do this online, but none of the tutorials were complete or worked for me. This way is clean and it works. Feel free to comment or post what worked for you.

in application config.ini


db.adapter = "PDO_MYSQL"
db.isdefaulttableadapter = true
db.params.dbname = "mydb"
db.params.username = "myuser"
db.params.password = "mypass"
db.params.host = "localhost"
db.params.charset = "UTF8"

then in my bootstrap i created the following


protected function _initDB()
{
$dbOptions = $this->getOption('db');
$db = Zend_Db::factory($dbOptions['adapter'], $dbOptions['params']);
Zend_Registry::set('db', $db);
Zend_Db_Table_Abstract::setDefaultAdapter($db);
}

optional: also in bootstrap if your want db profiling in firebug


protected function _initDbProfiler()
{
$this->bootstrap('db');
$profiler = new Zend_Db_Profiler_Firebug('All DB Queries');
$profiler->setEnabled(true);
Zend_Registry::get('db')->setProfiler($profiler);
}

and then wherever i need to do queries, (models, service, library etc)

$this->db = Zend_Registry::get('db');