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 7979535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:48:17+00:00 2026-06-04T09:48:17+00:00

when i want to connect database in zend framework with zend_Db, in each controller

  • 0

when i want to connect database in zend framework with zend_Db, in each controller or model must write this code:

$params = array(
'host'           => '127.0.0.1',
'username'       => 'webuser',
'password'       => 'xxxxxxxx',
'dbname'         => 'test',
'charset'        => 'utf8'
);

but when use Doctrine it’s enough to write this code in application.ini

doctrine.dsn = "mysql://user:pass@localhost/dbase"

how i can use zend_Db with out set connection setting in each file?

  • 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-06-04T09:48:18+00:00Added an answer on June 4, 2026 at 9:48 am

    open

    application/configs/application.ini
    

    add following lines

    resources.db.adapter = PDO_MYSQL
    resources.db.isDefaultAdapter = true
    resources.db.params.host = localhost
    resources.db.params.username = root
    resources.db.params.password = 
    resources.db.params.dbname = foo
    

    and then inside your Bootstrap.php

    do

    public function _initSetup()
    {
    $this->bootstrap('db');
    }
    

    and then whereever or whenever you need db instance simply do

    $db = Zend_Db_Table::getDefaultAdapter();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to connect to DB2 from excel macro...This is my code, but it
i want to connect to my database using beanshell script. my code works with
hi i want detail steps and programming code to connect database in android
Using VB6, SQL Server 2000 I want to connect to others system database. Code:
I want to connect to a remote database (SQL Server 2008) through code using
i want to connect database to iphone sdk but it is taking the default
I'm using PDO for connect to the database in a system where I want
I want to develop an application to connect to a PostgreSQL Database, I want
when we want to connect to database from visual studio should we always check(before
I want to connect to a database on a host except localhost, my DBMS

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.