Chapter 4. Administration and Configuration of GDA

Providers and Data Sources

Each different data source type is handled by a specialized server, called a provider. Every provider access one form of data. This may be a database, but this not necessarily so. It is theoretically possible to access LDAP servers, mailspools and other data sources, as soon as a provider is implemented. Therefore the client library doesn't assume very much about the characteristics of a provider. Therefore the interpretation of the meaning of the name of a source is also left to the provider. To have a unique and easy configurable naming system a configuration file is used. In this file names are mapped to providers and the connection string the provider needs to find the correct data source. How the provider interprets the connection string is described in the section about the specific providers.

Configuration of a Provider

GDA providers are CORBA servers which are activated using GOAD. GOAD gets it's configuration information from a set of files which are located in the ${prefix}/etc/CORBA/servers directory, where ${prefix} is the gnome installation path, or from the ~/.gnome/CORBA/servers directory. These files usually have the filename prefix .gnorba. The user directory entries are prefered over the system wide directory. The name of the configuration file is not significant, but the gnome-db packages used gnome_db.gnorba as the filename of the standard configuration file.

Each provider is defined with one section in this file. The current default file shipped with gnome-db contains an entry for the ODBC provider, the Postgres native provider and the MySQL provider.
(1)	      [gda-odbc]
(2)	      type=exe
(3)	      repo_id=IDL:GDA/ConnectionFactory:1.0
(4)	      description=Gnome Datasource Access for ODBC
(5)	      location_info=gda-odbc-srv
	      
	      [gda-mysql]
	      type=exe
	      repo_id=IDL:GDA/ConnectionFactory:1.0
	      description=Gnome Datasource Access for MySQL
	      location_info=gda-mysql-srv
	      
	      [gda-postgres]
	      type=exe
	      repo_id=IDL:GDA/ConnectionFactory:1.0
	      description=Gnome Datasource Access for Postgres
	      location_info=gda-postgres-srv
	      
	      [gda-oracle]
	      type=exe
	      repo_id=IDL:GDA/ConnectionFactory:1.0
	      description=Gnome Datasource Access for Oracle
	      location_info=gda-oracle-srv
	    

41GOAD Configuration File Entries

(1)
This is the name of the provider. The combination of this name and the type field has to be unique. This means it is possible to have a provider as shared library and as a standalone executable with the same name. How the user of the library can choose between the shared library implementation and the standalone executable is still not worked out yet.
(2)
This is the type of the server. If this entry has the value "exe", the provider is implemented as a standalone executable. This means that the provider is decoupled from the application using GDA and therefore safe from dangling pointers and other application errors. The drawback is that the latency between the application and the server is larger then with shared library servers. Shared library servers are defined with the value "shlib" in this field and are linked with the application during runtime.
(3)
The value of this field must be "IDL:GDA/ConnectionFactory:1.0". It is used to find GDA providers in all the GOAD configuration files.
(4)
This a a short one line description of the server. It is visible in the gda-mgr application and should describe the provider. It is for human use only.
(5)
This is the path name of the provider. If the path does not start with a "/", the implemention is searched for depending on its type. If the type is "exe", the provider is searched in the PATH of the user who starts the server. If the type is "shlib" the method for finding shared libraries is used. The exact way this is done depends on the operating system, but under Linux the LD_LIBRARY_PATH environment variable is used, then the directories in the /etc/ld.so.conf file.

Executable providers offer some advantages. They may be hosted on a different machine [1] and the startuptime of the provider is only needed once. The drawback is that if such a provider crashes all the clients are disconnected from the database. To overcome this problem it is possible for each client to request a new copy of the provider (although the client API doesn't yet provide this flag).

The other type of providers are shared library providers. These providers are linked to the client when the client requests something from the provider. The disadvantage is that the server is hosted on the same machine as the client. But a server crash only affects one client. The startup cost is comparable to an executable provider. The big advantage of this sort of providers is that debugging the provider code is simpler, since you must not attach gda to a running provider and you also can catch errors during server initialization.

Per default every GDA provider is available as an executable and as a shared library. The build process and the conventions used to implement the provider make sure that the executable and the shared library are made and installed.

Data Source Names

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, there is a configuration file named gdalib which names the available data sources and defines all the properties of such a data source, so that the correct data base server can be contacted. The information in this configuration file is accessed by the client library and sent to the provider.

The gdalib File

The format of the gdalib file follows the Gnome conventions and describes each datasouce and which provider is able to be used as a server.

Here is a part from a gdalib file.
(1)		[Datasources]
		Solid=Solid-entry
		Postgres-Native=Postgres-Native
		
(2)		[Solid-entry]
(3)		Provider=gda-odbc
(4)		DSN=Solid
(5)		Description=Solid Test Database for ODBC
(6)		Configurator=MODULE=odbc;ENTRY=Solid
		
		[Postgres-Native]
		Provider=gda-postgres
		DSN=DATABASE=test;HOST=localhost
		Description=Postgres Test Database in native mode
		Configurator=None
	      

42gdalib File Entries

(1)
This section names all data sources. The key is the data source name to be used by the client. It's value is the section name in this file which describes the data source.
(2)
This entry describes a data source which represents a Solid database. Solid is a small memory and disk footprint database which provides an ODBC client library.
(3)
The provider for this database is the gda-odbc provider. The value of this entry is used as the server name for the GOAD activation.
(4)
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.
(4)
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.
(6)
This entry denotes a glib module which is used to do the configuration for this provider. Some providers like gda-odbc and gda-sybase need additional configuration files. This entry tells the main configuration file which glib module to use and which additional parameters should be passed to the configuration function in the module.

This functionality is currently not implemented. Therefore the configuration tools for the datasource or a text editor has to be used to do the provider specific configuration.

The GDA Manager and Configurator

GDA comes with a configuration GUI to change the gdalib file. The tool is called gda-mgr and it provides a convenient way to browse the known entries, define new ones or delete them.

In the left tree window, you see all the providers. The information which server are available are taken from the GOAD configuration files, which are installed whenever a provider is installed. Selecting a provider, shows you the information available for this provider in the right portion of the main window. Currently you may edit the entries, but saving your changes is not implemented. The editing property will be retrieved from this window, since the provider properties are defined when a provider is installed and they shouldn't be changed.

The list of datasources configured for a provider is shown if you expand the tree at a provider node. If you select a provider in the expanded list, the right portion of the main window shows the configuration items for this data source. At the bottom of the page is a "Accept" button. Any changes you make in the edit fields in this mask take effect after you press the

Notes

[1]

I don't know yet how to do this. I think the GIOP_FORWARD messages are used in such a situation. I have not yet found out how to do this. i'll do this later