Define a data source (DSN)

The Configuration section details how to manage data sources definitions. To define a data source, one needs to create and fill a GdaDsnInfo structure, and use the gda_config_define_dsn() function.

For example the following code defines a data source:

GError *error = NULL;
GdaDsnInfo dsn_info = {
    "My DSN",
    "MySQL",
    "Sample MySQL data source",
    "HOST=myserver;DB_NAME=testdb"
    NULL,
    FALSE
};
if (!gda_config_define_dsn (&dsn_info, &error)) {
    /* an error occurred, the details are in error */
    g_error_free (error);
}