![]() |
![]() |
![]() |
![]() |
To open a connection, the programmer needs to specify the database provider to use, and some connection parameters, some of them specific to the database engine to be used, some of them more generic (such as the "DB_NAME" parameter to specify a database name).
All the parameters are combined together to give Libgda enough information to open a connection; refer to gda_connection_new_from_string() for more information.
However, remembering the complete string to open a connection can be tedious, and so Libgda supports named data sources (DSN) whereby a connection is specified and named once and opened refering to its name rather than to the actual parameters used. Refer to the Define a data source (DSN) section, and the gda_config_define_dsn() and gda_connection_new_from_dsn() functions.
DSN can have a scope limited to the user, or be system wide. User scope DSN definitions are stored in $XDG_DIR/libgda where $XDG_DIR is determined by the XDG Base Directory Specification (using g_get_user_data_dir()). System wide definitions are stored in $ETC/$VERSION where $ETC is the configuration directory where Libgda is installed and $VERSION is Libgda's major version.
Note that these locations can be changes using some properties of the global GdaConfig object.