How do I connect to the database from a module? I would like to connect to the database from a Drupal 7 module. Currently I only have the query I want to run which is:

$query = db_select('z_lists)
-&gt;fields('country')
-&gt;condition('value', $country, '=')
-&gt;execute()
-&gt;fetchAssoc();


What I can't figure out is how to establish a connection to the default database.

Any help?
Just execute the query, Drupal takes care of everything else.

If it doesn't work, then that's for another reason.

Also, see Given that db_select is much slower than db_query, why would I want to use it?