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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:24:39+00:00 2026-05-24T06:24:39+00:00

I am able to connect to a User DSN on my linux box (using

  • 0

I am able to connect to a User DSN on my linux box (using ODBC).

How do I get to connect using code igniter?

in my database.php I have the default database:

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'user';
$db['default']['password'] = 'pass';
$db['default']['database'] = 'db_main';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

however I also need to simultaneously connect to another database using ODBC:

So I have in my controller:

public function index()
    { 

         $dsn = 'NZSQL://someuser:password@host/somedatabase';
         $this->load->database($dsn);
         $this->db->query("SELECT * FROM Cust Limit 10");
         $result = $this->db->result();
    }

I get the error:

A Database Error Occurred

Error Number: 1146

Table ‘db_main.Cust’ doesn’t exist

SELECT * FROM Cust Limit 10

Filename: /var/www/controllers/netezzatest.php

Line Number: 28

  • 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-24T06:24:40+00:00Added an answer on May 24, 2026 at 6:24 am

    For each DB that you’re connecting to, Code Igniter will require you to build a new database object. You should build each DB out fully in the config file, then reference them by name (array key) when calling $this->load->database().

    See Connecting to Multiple Databases for specifics. But, basically, you need to use this to connect (creating an object for each DB):

    $DB1 = $this->load->database('group_one', TRUE);
    $DB2 = $this->load->database('group_two', TRUE);
    

    Then this to run queries on each:

    $DB1->query();
    $DB1->result();
    

    And:

    $DB2->query();
    $DB2->result();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am able to connect to an Oracle database using several tools, but am
I'm using SQL Server 2008. I should be able to connect to a user-specified
I want to connect to a remote database (SQL Server 2008) through code using
I have a VideoDisplay that is able to connect to a source and play.
I have Oracle SQL Developer already installed and am able to connect to and
I installed SQL Server 2005, and crated one user. I am able to connect
i am not able to connect to MySQL database after working approx 5 hours
In a Python web application, I am able to connect to Gmail using OAuth
I have been using the XMS API to connect to Websphere MQ and using
I'm trying to connect to Linux using SharpSSH, but am unable to. I want

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.