title: Zend_Db_Table::getDefaultAdapter is not working
body: <p>hi i am using zend framework , in my login controller index action . when a user submit the login form , i am trying to get the DefaultAdapter  , i tried it by </p>
  
  <pre><code>$db = Zend_Db_Table::getDefaultAdapter();
  </code></pre>
  
  <p>and this is not working . </p>
  
  <p>but i used </p>
  
  <pre><code>        $db = Zend_Db::factory('Pdo_Mysql', array(
                                                  'host'     =&gt; 'localhost',
                                                  'username' =&gt; 'root',
                                                  'password' =&gt; '123',
                                                  'dbname'   =&gt; 'test'
                                              ));
  </code></pre>
  
  <p>then it is working .</p>
  
  <p>this is my index action </p>
  
  <pre><code>public function indexAction() {
  
      $loginform = new Application_Form_LoginForm();
  
      if($this-&gt;getRequest()-&gt;getPost()) {
  
          $filter = new Zend_Filter_StripTags();
  
          $name = $filter-&gt;filter($this-&gt;getRequest()-&gt;getPost('name'));
          $password = $filter-&gt;filter($this-&gt;getRequest()-&gt;getPost('password'));          
  
          //$db = Zend_Db_Table::getDefaultAdapter();
  
          $db = Zend_Db::factory('Pdo_Mysql', array(
                                                  'host'     =&gt; 'localhost',
                                                  'username' =&gt; 'root',
                                                  'password' =&gt; '123',
                                                  'dbname'   =&gt; 'test'
                                              ));
  
          $authAdapter = new Zend_Auth_Adapter_DbTable($db);
  
          $authAdapter-&gt;setTableName('users');
          $authAdapter-&gt;setIdentityColumn('username');
          $authAdapter-&gt;setCredentialColumn('password');
  
          // Set the input credential values to authenticate against
          $authAdapter-&gt;setIdentity($name);
          $authAdapter-&gt;setCredential($password);
  
          // do the authentication
          $auth = Zend_Auth::getInstance();
          $result = $auth-&gt;authenticate($authAdapter);
  
          if ($result-&gt;isValid()) {
              // success : store database row to auth's storage system except the password column
              $data = $authAdapter-&gt;getResultRowObject(null, 'password');
              $auth-&gt;getStorage()-&gt;write($data);
              $this-&gt;_redirect('/index/');
          } else {
              $this-&gt;view-&gt;errors = array(0 =&gt; array(0 =&gt; 'Username and/or password are invalid.'));
              $this-&gt;view-&gt;form = $loginform;
          }
  
      }
      else {
  
          $this-&gt;view-&gt;form = $loginform;
      }   
  }
  </code></pre>
  
  <p>i have define my database connection details in my application.ini like this</p>
  
  <pre><code>resources.db.adapter = "PDO_MYSQL"
  resources.db.params.host = "localhost"
  resources.db.params.username = "root"
  resources.db.params.password = "123"
  resources.db.params.dbname = "test"
  </code></pre>
  
  <p>why my <code>Zend_Db_Table::getDefaultAdapter();</code> is not working , the error is </p>
  
  <pre><code>An error occurred
  Application error
  Exception information:
  
  Message: No database adapter present
  Stack trace:
  
  #0 /home/kanishka/workspace/hospital_system/library/Zend/Auth/Adapter/DbTable.php(140): Zend_Auth_Adapter_DbTable-&gt;_setDbAdapter(NULL)
  #1 /home/kanishka/workspace/hospital_system/application/controllers/LoginController.php(30): Zend_Auth_Adapter_DbTable-&gt;__construct(NULL)
  #2 /home/kanishka/workspace/hospital_system/library/Zend/Controller/Action.php(513): LoginController-&gt;indexAction()
  #3 /home/kanishka/workspace/hospital_system/library/Zend/Controller/Dispatcher/Standard.php(295): Zend_Controller_Action-&gt;dispatch('indexAction')
  #4 /home/kanishka/workspace/hospital_system/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard-&gt;dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
  #5 /home/kanishka/workspace/hospital_system/library/Zend/Application/Bootstrap/Bootstrap.php(97): Zend_Controller_Front-&gt;dispatch()
  #6 /home/kanishka/workspace/hospital_system/library/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap-&gt;run()
  #7 /home/kanishka/workspace/hospital_system/public/index.php(26): Zend_Application-&gt;run()
  #8 {main}  
  
  Request Parameters:
  
  array (
    'controller' =&gt; 'login',
    'action' =&gt; 'index',
    'module' =&gt; 'default',
    'name' =&gt; '',
    'password' =&gt; '',
    'submit' =&gt; 'submit',
  )  
  </code></pre>