Blog do projektu Open Source JavaHotel

czwartek, 1 lipca 2010

ODBC 64 bit and DB2

Finally I installed ODBC DB2 64 bit for Linux. Nothing special, all what what is needed to do is to modify /etc/odbcinst.ini file (or use ODBConfig tool) with driver definition like:

[DB2]
Description        =
Driver        = /opt/ibm/db2/V9.7/lib32/libdb2.so
Driver64        = /opt/ibm/db2/V9.7/lib64/libdb2.so
Setup        =
Setup64        =
UsageCount        = 1
CPTimeout        =
CPReuse        = 
Next step is to define data source. Unfortunately ODBCConfig tool does not work for this purpose (probably because setup driver is not accessible). But it is enough to modify /etc/odbc.ini (or local odbc.ini) file, ODBConfig is nothing more than GUI tool for modifying those files.

I added section like:
[SAMPLE]
DESCRIPTION = Connection to DB2
DRIVER = DB2
Database = SAMPLE
And from time on ODBC connection to DB2 world is open and ready to use.


$ isql SAMPLE db2inst1 db2inst1
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> select * from emp where JOB = 'MANAGER'+-------+-------------+--------+----------------+---------+--------+--------------------+---------+--------+----+--------------------+------------+------------+------------+| EMPNO | FIRSTNME    | MIDINIT| LASTNAME       | WORKDEPT| PHONENO| HIREDATE           | JOB     | EDLEVEL| SEX| BIRTHDATE          | SALARY     | BONUS      | COMM       |+-------+-------------+--------+----------------+---------+--------+--------------------+---------+--------+----+--------------------+------------+------------+------------+| 000020| MICHAEL     | L      | THOMPSON       | B01     | 3476   | 2003-10-10 00:00:00| MANAGER | 18     | M  | 1978-02-02 00:00:00| 94250,00   | 800,00     | 3300,00    || 000030| SALLY       | A      | KWAN           | C01     | 4738   | 2005-04-05 00:00:00| MANAGER | 20     | F  | 1971-05-11 00:00:00| 98250,00   | 800,00     | 3060,00    || 000050| JOHN        | B      | GEYER          | E01     | 6789   | 1979-08-17 00:00:00| MANAGER | 16     | M  | 1955-09-15 00:00:00| 80175,00   | 800,00     | 3214,00    || 000060| IRVING      | F      | STERN          | D11     | 6423   | 2003-09-14 00:00:00| MANAGER | 16     | M  | 1975-07-07 00:00:00| 72250,00   | 500,00     | 2580,00    || 000070| EVA         | D      | PULASKI        | D21     | 7831   | 2005-09-30 00:00:00| MANAGER | 16     | F  | 2003-05-26 00:00:00| 96170,00   | 700,00     | 2893,00    || 000090| EILEEN      | W      | HENDERSON      | E11     | 5498   | 2000-08-15 00:00:00| MANAGER | 16     | F  | 1971-05-15 00:00:00| 89750,00   | 600,00     | 2380,00    || 000100| THEODORE    | Q      | SPENSER        | E21     | 0972   | 2000-06-19 00:00:00| MANAGER | 14     | M  | 1980-12-18 00:00:00| 86150,00   | 500,00     | 2092,00    |+-------+-------------+--------+----------------+---------+--------+--------------------+---------+--------+----+--------------------+------------+------------+------------+SQLRowCount returns -17 rows fetched
Next step to 64 bit world taken.

Brak komentarzy:

Prześlij komentarz