Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't connect to DB2 using unixODBC/DB2 Connect from Oracle on AIX

312474Aug 31 2009 — edited Apr 12 2013
Note: square brackets may show up as underlines when posted

Could someone please help me troubleshoot the following:

I need to use ODBC/heterogeneous services to connect to DB2
AIX 5.3
Oracle 64bit

I downloaded unixODBC-2.2.12 and installed it in /myhome/unixODBC.
Untarred the v9.5fp2_aix64_odbc_cli_32.tar.gz (libdb2.a) into /myhome/db2/clidriver/lib
(I tried with 64 bit driver too)

odbc.ini_

[ODBC]
Trace=yes
Tracefile=/myhome/unixODBC/odbc.log

[ODBC Data Sources]
DB2DB=Db2 Connect Driver

[DB2DB]
Description=DB2 Development Database
Driver=DB2

odbcinst.ini_

[DB2]
Description=DB2 ODBC Driver
Driver=/myhome/db2/clidriver/lib/libdb2.a
Fileusage=1
Dontdlclose=1
dbalias=DB2DB
DB2SYSTEM=10.1.100.10
ServerType=DB2MVS
Nodetype=U
Protocol=TCPIP
Hostname=10.1.100.10
Portnumber=5021
Security=0

[ODBC]
Trace=Yes
Tracefile=/myhome/unixODBC/odbc_trc.log

*$ odbcinst -j*
unixODBC 2.2.12
DRIVERS............: /myhome/unixODBC/etc/odbcinst.ini
SYSTEM DATA SOURCES: /myhome/unixODBC/etc/odbc.ini
USER DATA SOURCES..: /myhome/unixODBC/etc/odbc.ini

Configured the environment as follows:

listener.ora_

(SID_DESC=
(SID_NAME = DB2DB)
(ORACLE_HOME = /apps/oracle/10.2.0)
(PROGRAM = hsodbc)
(ENVS = LD_LIBRARY_PATH = /apps/oracle/10.2.0/lib32:/myhome/db2/clidriver/lib)
)

tnsnames.ora_

DB2DB.WORLD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL=tcp)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA = (SID = DB2DB))
(HS = OK)
)
)

initDB2DB.ora*

HS_FDS_CONNECT_INFO = DB2DB
HS_FDS_TRACE_LEVEL = OFF
HS_FDS_SHAREABLE_NAME = /myhome/unixODBC/lib/libodbc.a

# ODBC specific environment variables
set ODBCINI=/myhome/unixODBC/etc/odbc.ini


Reloaded the listener

database link DB2DB_

create database link DB2DB
connect to "<uid"
identified by "<pwd>"
using 'DB2DB.WORLD'

TNSPING Works_

$ tnsping db2db

TNS Ping Utility for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Production on 31-AUG-2009 16:01:54

Copyright (c) 1997, 2007, Oracle. All rights reserved.

Used parameter files:
/apps/oracle/10.2.0/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL=tcp)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SID = DB2DB)) (HS
= OK))
OK (10 msec)


But when I try to connect using the DB link it doesn't work.
SQL> select * from dual@DB2DB.WORLD;
select * from dual@db2db.world
*
ERROR at line 1:
ORA-28545: error diagnosed by Net8 when connecting to an agent
Unable to retrieve text of NETWORK/NCR message 65535
ORA-02063: preceding 2 lines from DB2DB

When I try using isql, here is the result. It can't open the libdb2.a

*$ isql -v DB2DB <uid> <pwd>*
[01000][unixODBC][Driver Manager]Can't open lib '/myhome/db2/clidriver/lib/libdb2.a' : 0509-022 Cannot load module /myhome/db2/clidriver/lib/libdb2.a.
0509-103 The module has an invalid magic number.
[ISQL]ERROR: Could not SQLConnect



Any help is very much appreciated.

Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 10 2013
Added on Aug 31 2009
7 comments
5,875 views