How to simultaneously access the same MySQL database in the main column and sidebar of WordPress?

First of all dont use Exec-PHP plugin, instead of it write your own. Second use $wpdb object (instance of WPDB class) to make all calls to database.