Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6712501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:16:01+00:00 2026-05-26T08:16:01+00:00

Ok I am having real difficulty solving this. I’m trying to connect to a

  • 0

Ok I am having real difficulty solving this. I’m trying to connect to a mysql database from a zend application and i receive the following error:

Message: No database adapter present

I have checked and double checked the connection credentials and they should be fine. The code should be fine too as it works ok in the development environment. If I deliberately change the password to be incorrect in the development environment, I get exactly the same error, which leads me to believe that maybe this is the case, despite my checking!

Any thoughts would be very welcome. If there’s nothing obviously wrong here then maybe I need to look at the server/db/php settings?

Thanks!

Bootstrap code:

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initPlaceholders(){
    Zend_Session::start();

    $this->bootstrap('View');
    $view = $this->getResource('View');

    $view->doctype('XHTML1_STRICT');

    // Set the initial stylesheet:
    $view->headLink()->appendStylesheet('/css/global.css');

    $autoloader = Zend_Loader_Autoloader::getInstance();
    $autoloader->registerNamespace('Pog_');


    Zend_Controller_Action_HelperBroker::addPath(
    APPLICATION_PATH . '/controllers/helpers',
        'Application_Controller_Action_Helper_');

}


}

Config file:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.view[] =
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view.helperPath.View_Helper = APPLICATION_PATH "/views/helpers"
database.adapter         = pdo_mysql
database.params.host     = localhost
database.params.username = user
database.params.password = password
database.params.dbname   = test

DB connection helper:

/**
 * Constructor: initialize plugin loader
 *
 * @return void
 */
public function __construct()
{
    try{

        $config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', 'production');
        $dbAdapter = Zend_Db::factory($config->database);
        $dbAdapter->getConnection();
        $this->connection = $dbAdapter;
    } catch (Zend_Db_Adapter_Exception $e) {
        echo 'perhaps a failed login credential, or perhaps the RDBMS is not running';
    } catch (Zend_Exception $e) {
        echo 'perhaps factory() failed to load the specified Adapter class';
    }
}
public function getDbConnection(){
    return $this->connection;
}
}

Index:

// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';

// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
        ->run();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:16:02+00:00Added an answer on May 26, 2026 at 8:16 am

    Define your database as a resource

    resources.db.adapter = pdo_mysql
    resources.db.params.host = localhost
    resources.db.params.username = user
    resources.db.params.password = password
    resources.db.params.dbname = test
    

    In your main files you then need to do nothing but initiate a query without having to worry about assigning the database fvrom your config – its done in the inside, the DB resource is always chosen as the default adapter for your database transactions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having real trouble trying to get decent answers to my questions from
I'm having real difficulty with this but I'm no javascript expert. All I want
I'm having a real difficult time getting this code to work. I'm trying to
I am having some real difficulty attempting to solve a JQuery $.each() iteration This
So I am having some real difficulty figuring out how to make the following
I am having difficulty trying to return values from an XML file. Here is
I'm having real problems getting PDO_MYSQL working. I started by just trying to install
I am having a real pain in converting this query expression into my LINQ
I'm having a real trouble to get accents right, and I believe this may
I am having a real headache trying to set a node's local position to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.