## Configuring

Depending on the use you're going to get out of libgda, you may have to dig deep into its internals, but don't be afraid, things have been implemented to be easy to use.

### Configuration for development

If you want to develop applications using libgda, you should install the libgda-dev[el] package if you do a RPM or Debian-based installation. If you compiled the source code, development files are installed in your system.

The only step you need to do to make sure everything is well installed, is to check that libgda libraries and binaries are seen by your system. That is, make sure that the libgda `bin/` directory is in your `PATH` environment variable, as well as the `lib/` in your `LD_LIBRARY_PATH` (or `/etc/ld.so.conf` file).

Programs which need to use libgda's features need to include a headers file, which is:

    #include <libgda/libgda.h>

and to use reports:

    #include <libgda/libgda.h>
    #include <libgda-report/libgda-report.h>

and to use virtual connections:

    #include <libgda/libgda.h>
    #include <virtual/libgda-virtual.h>

### Configuration for accessing a database

To access a database, it must have a database provider (if libgda does not support the type of database to access, make a bug report in bugzilla), and that database provider must be compiled an installed: the gda-list-config-3.0 or gda-sql-3.0 -L commands will show a list of the installed and configured database providers.

Any connection to a database can be done either using a pre-defined data source, or using a connection string: using a data source (DSN) allows one to name connections and define them once, whereas using connection strings allows programs to be more independant of any libgda configuration. Anyway, defining a DSN involves defining the same parameters as for a connection string.

A connection string is a semi-colon delimited list of named parameters (as <param1_name>=<param1_value>;<param2_name>=<param2_value>...), the parameters being specific to each database provider (the two commands mentionned above also list all the parameters for each provider).

DSNs can be configured on a per-user basis or on a system-wide basis. Each user's own DSN definitions are stored in the `$HOME/.libgda/config` file (which is created the first time libgda is used within an application. System wide DSN are defined in the `<prefix>/etc/libgda/config`. Rather than editing that file manually, it is possible to use the gnome-database-properties-3.0 from the Libgnomedb library.

### Provider's specific information

This section provides information specific to each of the available libgda providers.

#### Default provider

The GDA default provider (based on an SQLite database file) is always installed with libgda, which means that a default database system is always available. Specifically the first time you use libgda, a test database is copied into `$HOME/.libgda` and named "SalesTest".

#### ODBC Provider

The ODBC provider is a special case, since ODBC is itself a data access layer, the same as libgda. So, in the case of the GDA ODBC provider, the DSN string is completely up to the ODBC driver manager. That is, the GDA ODBC provider does not parse it all, nor does it try to understand what it means; it simply passes it over to the ODBC library.

So, if you want to use libgda with ODBC, you should first know how to set up an ODBC data source, and then just specify the DSN string you would pass to the ODBC library in the DSN string of the GDA data sources.

There is a project called unixODBC, which provides some graphical tools to help you in setting up ODBC data sources. You may find it interesting to give it a try.

#### Common to all provider

Each provider exports a list of the arguments it requires in its connection string which is used internally by libgda to establish each connection. If you don't use a GUI which proposes you valid choices (such as GNOME-DB), you can get that list in each file named `<provider_name>_specs_dsn.xml` installed in the `$PREFIX/share/libgda` directory. This file is easy to parse and read.