# Connecting

To connect you need to use two functions. We use gda_client_new () to create a connection pool and use gda_client_open_connection () to create the specific connections to the different data sources.

            void
            do_stuff ()
            {
              GdaClient *client;
              GdaConnection *connection;

              list_providers ();
              list_datasources ();

              client = gda_client_new ();

              g_print ("CONNECTING\n");
              connection = gda_client_open_connection (client, "calvaris", NULL, NULL);
              g_print ("CONNECTED\n");

              proving_errors (connection);

              process_accounts(connection);

              gda_client_close_all_connections (client);

            }

  Creates the connection pool.
  Creates the connection to calvaris data source with the default username and password you have specify when creating the data source. However, you can specify them if you want.
  It's a good practice to close connections when you finish using them. It doesn't mean that you must close them each time you use them. It's better open the connections when program starts and use them during the whole execution.