Connect to database in the header of my WordPress website

You can (and should) use the existing database connection by accessing global $wpdb. The simplest way to use it is with the get_results() method:

global $wpdb;
$results = $wpdb->get_results( 'SELECT * FROM my_table' );

There’s other methods available, and things you need to consider like preparing queries and using the correct table prefix (if your table has one). An overview for all this is available in the Codex, and you’ll find many helpful guides if you search Google for “wpdb”.