ODBC – Other Databases.
Windows ODBC Overview
Once a database has been installed that uses ODBC, a connection setup can usually be created using the Querix Connect tool within ‘HydraStudio’.
- In ‘HydraStudio’, at the bottom of the Project tree space, select the database that you want to setup a connection for from the dropdown database list.
- From the menu, choose Tools and select Database Connections.
The Querix Connect window is displayed.
- To add a new connection, click the ODBC Administrator button.
The ODBC Data Source Administrator window is displayed.
- In the ODBC Data Source Administrator window, choose the System DSN tab and click the Add button.
The Create New Database Source window is displayed.
- From the list of database drivers displayed, highlight the one for which you want to add a new connection setup, and click the Finish button.
The ODBC DSN Setup window is displayed for the database and engine type that you selected.
- In the Client region, Data Source Name field, type a name to identify this connection setup.
- In the Server region, Address field, type the host name or IP address.
- In the Transport Hint field, select the appropriate protocol options.
- In the Data Source Name field, click the Get DSN List button and select the appropriate DSN engine; OR click the Create button and, in the Logon dialog displayed, type the Username and Password in the appropriate fields.
- Click the OK button.
Unix/Linux ODBC Connections
For a Unix/Linux connection there are three main stages needed. These are:
- Install the iODBC driver manager
- Install the ODBC driver for your chosen database
- Set up the DSN. The iODBC driver manager for Unix/Linux platforms can be downloaded from: http://www.iodbc.org by following the “downloads, cvs” link.
The appropriate ODBC driver for your chosen database is available on the supplier’s Web site.
Installing the iODBC Driver Manager
The iODBC Driver Manager can be downloaded as an rpm file, or for older platform versions, a tar.gz file. You will need to build the driver manager. Download the appropriate file and copy it to your /usr directory. If you have a tar.gz file follow steps 1 to 3 and then continue at step 5, for an rpm file start at step 4.
- With the downloaded file in the /usr directory, unzip the file with the command:
- Extract the files with the command:
tar xvf libiodbc-3.51.1..tar
- Change directory to the newly created installation directory with the command:
- For an rpm file, run the command:
rpm –i file_name
- In the new directory run the command:
./configure The system will carry out a series of configuration functions.
- Run the command:
- Run the command:
Creating a DSN
The database and the DSN must have the same name, otherwise serious system error may be encountered. You will also need to find the location of the psqlodbc.so file before starting to create the DSN. This will probably be /usr/lib/psqlodbc.so.
- Search for the file /etc/odbc.ini. This may have been created during the iODBC installation. If it has not, you will need to create the file manually. If you have to create the /etc/odbc.ini file manually it should look something like the example shown in Step 2.
- Add the following details to the odbc.ini file: In the following code ‘cms’ is the name of the database application. Database_name is the name of the type of database being used, such as Oracle, MySQL or PostgreSQL.
[ODBC Data Sources]
cms = Database_name cms
Description = Database_name cms
Driver = /usr/lib/ Database_nameodbc.so
Trace = No
TraceFile = /tmp/odbc.log
Databse = cms
Port = 5432
Protocol = 6.4
ReadOnly = Yes
RowVersioning = No
ShowSystemTables = No
SowOidColumn = No
FakeOidIndex = No
- Edit the following settings in your environment:
Each user can have their own odbc.ini file if needed. If you want to test the connection to the database, you can use the ‘odbctest' tool, provided by iODBC, as well as the ‘testconn' application in 'HydraStudio'.