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 ();
        
(1)          client = gda_client_new ();
        
          g_print ("CONNECTING\n");
(2)          connection = gda_client_open_connection (client, "calvaris", NULL, NULL);
          g_print ("CONNECTED\n");
        
          proving_errors (connection);
        
          process_accounts(connection);
        
(3)          gda_client_close_all_connections (client);
        
        }
        
(1)
Creates the connection pool.
(2)
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.
(3)
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.