Data catalog
The data catalog provides a registry for data sources. This makes administration of databases easier, since instead defining the data source in decentralized configuration or ini-files, each data source is registered once, only, in the data catalog. Changing the data source location later on requires changing the entry only in the data catalog. Otherwise, all configuration files referring to the data source have to be updated.
In order to make the catalog available in an application, a [DATA-CATALOG] section has to be defined in the configuration or ini-file. When running in client server environment, the catalog is defined on the server side and will be opened by the server.
The data catalog is a simple ODABA database, which creates a DataSource instance for each data source added to the catalog. The data catalog can be created using the Object Commander . You may also provide an OSI script in order to setup the data sources in a data catalog.
DataSource and object type is part of the extended ODABA tools object model and not defined in the system dictionary. Hence, for accessing data catalog entries
There are different ways of accessing the data catalog. One may open the data catalog directly in the application using the system dictionary ode.sys as dictionary and opening the catalog database with the corresponding database path (see "Using database handle").
In order to access the catalog, one may also get the catalog object space handle from the application ( Application ::catalogObjectSpace() ). Before accessing the catalog opened for the application, the application has to be initialized ( Application ::initialize() ) with a configuration or ini-file, which contains a valid catalog definition.
// section in an ini-file for defining the data catalog
// [DATA-CATALOG]
// DICTIONARY=c:/odaba/ode.sys
// DATABASE=c:/odaba/ocatalog.dat
// NET=YES
int main (argc, char *argv[]) {
if ( argc < 2 ) THROW
// parm 1: path to ini-file with the catalog definition
Application::initialize(argv[1],"Catalog Browser");
ObjectSpace os(Application::catalogObjectSpace());
Property dataSource(os,"SDB_DataSource",Read);
Value name(dataSource,"name");
while ( dataSource.next() )
Application::output(name.toString());
return 0;
}