Programmer Guide : solidDB® ODBC API : Connecting to a data source : Using logical data source names
  
Using logical data source names
If the data source name is not a valid solidDB® connect string, the driver assumes it is a logical data source name.
The logical data source name can be mapped to a data source as a “logical name” and “connect string” (network name) pair in the following ways:
Using the [Data Sources] section in the client-side solid.ini file
The syntax of the parameters is the following:
[Data Sources]
logical_name = connect_string; Description
where Description can be used for comments on the purpose of the logical name
Example:
To map a logical name My_application to a database that you want to connect using TCP/IP, include the following lines in the solid.ini file:
[Data Sources]
My_application = tcpip irix 1313; Sample data source
When an application calls the data source “My_application”, the solidDB® client maps this to a call to “tcpip irix 1313”.
In Windows environments, using the registry settings (ODBC Driver Manager)
You can use the Control Panel > Administrative Tools > Data Sources (ODBC) dialog or the Registry Editor (regedit) to add mappings.
For details, see Configuring the solidDB® ODBC Data Source for Windows in the solidDB® Programmer Guide.
Tip: The solidDB® data management tools use the solidDB® ODBC API. If you have defined an ODBC Data Source, you can use the logical name source name also when connecting to solidDB® server with the solidDB® tools.
For example, if you have created a data source named “solid_1” with ServerName “tcp 2525”, you can connect to the solidDB® server with solidDB® SQL Editor (solsql) using the following command:
solsql solid_1
When connecting to the solidDB® server, if the network name is not a valid connect string, the solidDB® tools and clients assume it is a logical data source name. To find a mapping between the logical data source name and a valid connect string, the solidDB® tools and clients check the client-side solid.ini file.
In Windows environments, if the solid.ini file is not found or the logical data source name is not defined in the [Data Sources] section, the data source settings made with the Windows registry settings are checked in the following order.
1 Look for the Data Source Name from the following registry path:
HKEY_CURRENT_USER\software\odbc\odbc.ini\DSN
2 Look for the Data Source Name from the following registry path
HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\DSN
The check for the logical data source mappings might impact performance:
If the file system is particularly slow, for example, because the working directory is mapped to a network drive, checking the existence of the solid.ini file can have a measurable performance impact.
In Windows environments, all logical data source mappings in the ODBC registry are checked. The time consumed for this operation is proportional to the amount of defined data sources.
– With only few (1 to 5) data sources, the connection time will be approximately 5 ms.
– With 1000 data sources, the connection time will be approximately 200 ms.
However, if the solid.ini file contains the logical data source name mapping, the tools and clients do not try to access the ODBC registry for the mapping.
See also
Connecting to a data source