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).

Configuration for accessing a database

If you want to access a data source through a GDA provider, you must first of all have access to this provider, and most importantly, this provider should have access to its specific data source. So, first have your database up and running. For this, you'll have to check your specific data source documentation, or see the libgda providers' specific documentation.

Once you've got your GDA provider installed, whether on your machine or on another one on the network, you must configure your local system to have access to it. If you're on a local installation, once you have installed the GDA provider (by compiling it or by installing its RPM or Debian package), the provider is visible in your machine. This is because the provider package provides an .oafinfo file in which it specifies the location and other information about itself.

If, on the orher hand, your provider is on another machine, you'll have to create the .oafinfo yourself. For this, you'll need to check the OAF installation documentation.

Then, the next step is to configure the data sources you want available on your system. For doing this, you should, as for now, use GNOME-DB, which is a frontend to libgda for the GNOME project. [1]

Command-line tools will be provided in libgda for doing so in a not-too-distant future, so you may want to know what information you need to setup a data source.

One of the problem GDA solves is the naming of data sources. Every database system has it's own way of defining names for it's databases. For example MySQL uses the hostname, port number, and the name of the database. Other databases, like Solid use the hostname and port number only. There is no support for multiple databases per server. Because the client does not need all these details, the libgda configuration defines all the properties of such a data source, so that the correct data base server can be contacted. This information is accessed by the client library and sent to the provider, which in turn will parse the string to decide which database must be connected to. The data stored for each data source is as follows: [sales] Provider=OAFIID:GNOME_GDA_Provider_MySQL_ConnectionFactory DSN=DATABASE=test;HOST=localhost;PORT=1111 Description=MySQL Test Database in native mode Configurator=None

(1)
The provider for this database is the gda-mysql provider. The value of this entry is used as the object ID for the OAF activation.
(11)
This is the most important entry. The value of this entry is the string sent to the provider so that it knows which datasouce to access. How this entry is interpreted by the providers is described in the provider section.
(28)
The value of this entry is a short description of the datasource. It is here for convenience only and it is not used for any purpose.

Provider's specific information

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

Default provider

The GDA default provider is always installed with libgda, which means that you've got always a default database system available for you. To connect to a default provider's database, you only need to specify, in the DSN string, a string of the form "DIRECTORY=/directory/for/the/database". When you first connect to the new data source, the GDA default provider will create the database, in the directory you specified in the DSN string, if it does not exist.

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.

PostgreSQL Provider

To use the GDA PostgreSQL provider, you'll need the gda-postgres package.

The PostgreSQL provider accepts the following arguments in the GDA data source's DSN string:

  • HOST: name of the host where the database server is running

  • DATABASE: name of the database you want to access

MySQL Provider

To configure a data source to access a MySQL database, you'll need to install the GDA MySQL provider (package gda-mysql).

It accepts the following arguments in the DSN string:

Notes

[1]

It would be a good idea to add a command-line tool for managing the configuration, as now, using GConf, is not a matter of hacking on a config text file, as it was befofe with gnome_config. The API for doing so is already available in the libgda-commonlibrary, so it would be really easy. Volunteers?