0
votes

I'm trying to connect to db2 database, trought symfony php app, via ODBC driver, and db2 installed driver (IBM Data Server Driver Package v11.5 ). I'm on MAC OS 10.15 CATALINA, with APACHE, and PHP reinstalled with brew.

I stuck at this error:

SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib 'IBMDB2' : file not found

Where IBMDB2 refers to the DSN of my odbc driver, linked to the driver installed to /Applications/dsdriver/lib/libdb2.dylib

Could you please help me to solve this "file not found" error (of course file exist in /Applications/dsdriver/lib/libdb2.dylib) ?

This is my /Library/ODBC/odbc.ini file:

[ODBC Data Sources]
IBMDB2 = IBM i Access ODBC Driver

[IBMDB2]
Driver = /Applications/dsdriver/lib/libdb2.dylib

This is my /Library/ODBC/odbcinst.ini file:

[IBM i Access ODBC Driver]

Description=IBM i Access ODBC Driver

Driver=/Applications/dsdriver/lib/libdb2o.dylib

Setup=/Applications/dsdriver/lib/libdb2o.dylib

This is result of "env" command

TMPDIR=/var/folders/8_/l5_n27ds14ndr7tmw0dg97jr0000gn/T/

XPC_FLAGS=0x0

LaunchInstanceID=57ABF727-826C-4D96-9032-BDBB8637FFD6

TERM=xterm-256color

LANG=fr_FR.UTF-8

SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.E2JaUTZ9TW/Listeners

SECURITYSESSIONID=186a6

XPC_SERVICE_NAME=0

TERM_PROGRAM=Apple_Terminal

TERM_PROGRAM_VERSION=433

TERM_SESSION_ID=AA52FB63-601C-4003-8275-6C3E365531DD

SHELL=/bin/zsh

HOME=/Users/yornletard

LOGNAME=yornletard

USER=yornletard

PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

SHLVL=1

PWD=/Users/yornletard

OLDPWD=/Users/yornletard

ODBCINI=/Library/ODBC/odbc.ini

ODBCINSTINI=/Library/ODBC/odbcinst.ini

_=/usr/bin/env
1
please edit your question to give the full version of the IBM i access product that you have installed. Can you also confirm that the target Db2-database lives on the AS/400 (i-series) ?mao
I installed "IBM Data Server Driver Package v11.5". DB2 database is fully operative because I access it from the same symfony app installed on a ubuntu OS.YornLetard
Please answer the question: confirm that the Db2-database is running on AS/400 (i series). That means, the database lives on the as/400. You cannot mix your drivers (between the V11.5 driver package, and the IBM i access product).mao
I confirm that the db2 database is running on AS/400YornLetard
You need to use only the files from the IBM i access product, with the unixODBC. In the INI files, Don't reference the files from the IBM data server driver (as they require a Db2-connect licence file to connect to AS/400), which the IBM i access libraries do not need. Your configuration is not valid.mao

1 Answers

0
votes

As mao told me, I was able to connect from my mac os to db2 database using "IBM i access" product. I was using a wrong package driver. Thanks to him

I download ibm i access product: https://www.ibm.com/support/pages/ibm-i-access-client-solutions

Then installed, and auto config with embeded script (require unixODBC installed with brew)

/Library/IBMiAccess/register_driver