Need To Fetch And Display The External Database Table And Fields In Report Modules


I need to fetch the external database table list and selected table fields in some modules.

How could I connect external db connection.

And, how could I list those tables and fields.


You can do that using CDbConnection

Or you can add the external db connection array in the config/main.php file itself…

Thanks for reply,

I created using DbConnection, its working fine. But listing table names not working by using getTableNames(). How could I list those table name.

Thanks in advance.

As i understand you need to connect to multiple db at same time. This will help you

sorry hemc,

I dont want connect multiple db at same time.

In a particular module only, I need to connect the external db from user given connection string, and listing out those db tables, and need to select one or more tables from those list and need to display those selected tables fields.