DB2 driver for the mac... how's it going?

133 views
Skip to first unread message

Bingimar

unread,
Jun 8, 2008, 5:51:44 PM6/8/08
to ibm_db
What is the news on the db2 driver for the mac?

tarun....@in.ibm.com

unread,
Jun 9, 2008, 1:01:13 AM6/9/08
to ibm_db
Hi Binglmar

We provide DB2 Driver and wrapper for Python and support SQLAlchemy
adaptor too.

Link for DB2 Driver and DBI wrapper- http://pypi.python.org/pypi/ibm_db/0.2.9
Link for SQLAlchemy adaptor - http://pypi.python.org/pypi/ibm_db_sa/0.1.5

We have not tested these on MacOS yet but since the wrapper is in
python it should work flawlessly. However, we are pleased that you
raised a request for this and we would test the driver on Mac and
would get back to you by the end of week.

Meanwhile, you can try it on MacOS and let us know if you are facing
certain issues.

Thank you for choosing our driver

tarun....@in.ibm.com

unread,
Jun 9, 2008, 1:12:31 AM6/9/08
to ibm_db
I would also like to ask, if you are using Mac OS as server or
client??

DB2 server on MacOS is currently not supported so I am not sure what
specification you are looking for while building your application.
However, the CLI for MacOS is available for download at -
https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&source=swg-informixfpd

Please let us know your thoughts.

On Jun 9, 2:51 am, Bingimar <bjarni.julius...@gmail.com> wrote:

Bingimar

unread,
Jun 10, 2008, 1:11:10 PM6/10/08
to ibm_db
The mac osx is the server(http) and the iSeries machine is the db2
server,

so yes, mac client, and iSeries server.

regards

On Jun 9, 7:12 am, tarun.pasr...@in.ibm.com wrote:
> I would also like to ask, if you are using Mac OS as server or
> client??
>
> DB2 server on MacOS is currently not supported so I am not sure what
> specification you are looking for while building your application.
> However, the CLI for MacOS is available for download at -https://www14.software.ibm.com/webapp/iwm/web/preLogin.do?lang=en_US&...

Bingimar

unread,
Jun 10, 2008, 1:19:12 PM6/10/08
to ibm_db
Ok, I'm no linux/python expert, but I was trying to build the DB2
Driver ( ibm_db ) on with this command "python setup.py build"

and got this error
----------------
IBM DataServer environment not set. Please refer to the README for
more information on building the driver
----------------



On Jun 9, 7:01 am, tarun.pasr...@in.ibm.com wrote:
> Hi Binglmar
>
> We provide DB2 Driver and wrapper for Python and support SQLAlchemy
> adaptor too.
>
> Link for DB2 Driver and DBI wrapper-http://pypi.python.org/pypi/ibm_db/0.2.9
> Link for SQLAlchemy adaptor -http://pypi.python.org/pypi/ibm_db_sa/0.1.5

tarun....@in.ibm.com

unread,
Jun 10, 2008, 1:27:37 PM6/10/08
to ibm_db
The environment variables for DB2 needs to be set for Database driver
to be installed since it tries to search for library paths. I have got
the scenerio that you are working on. I would try to simulate the same
environment and get back to you with the series of steps that you need
to follow.

Thanks and Regards
Tarun Pasrija

Bingimar

unread,
Jun 10, 2008, 1:35:40 PM6/10/08
to ibm_db
Ok thanks, you are my hero.

tarun....@in.ibm.com

unread,
Jun 11, 2008, 9:26:59 AM6/11/08
to ibm_db
Hi...

The python driver works fine with MacOS and DB2. Please follow the
steps below for installation of Python DB2 Driver on MacOS.

Step - 1 :- Install the ThinCli Db2 driver on MacOS.
Step - 2 :- You need to have setuptools installed to proceed with
module setup.
Step - 3 :- Export the following environment variables

export PATH=<PYTHON_INSTALL_PATH>/bin:$PATH
export IBM_DB_LIB=<DB2CLI_DRIVER_PATH>/lib
export IBM_DB_DIR=<DB2CLI_DRIVER_PATH>
export PYTHONPATH=<PYTHON_INSTALL_PATH>/lib/python2.5/site-packages/
ibm_db-0.2.9-py2.5-macosx-10.3-i386.egg
export LANG=en_US.UTF-8

Step - 4 :- Download the latest driver source code and install.

Step - 5 :- Run the following piece of code to validate.

import ibm_db,sys

conn_str =
"DATABASE=databat;HOSTNAME=x.yourmachine.in.com;PORT=60000;PROTOCOL=TCPIP;UID=db2inst1;PWD=password;"
try:
ibm_db_conn = ibm_db.connect(conn_str, ' ', ' ')
print "Connection Success"
print ibm_db_conn
except:
print "Error"

Following these steps to have Python working with MacOS and DB2
Server.

Thanks and Regards
Tarun Pasrija

On Jun 9, 2:51 am, Bingimar <bjarni.julius...@gmail.com> wrote:

Bingimar

unread,
Jun 26, 2008, 7:00:19 AM6/26/08
to ibm_db
while trying to run the command "python setup.py install" on the
ibm_db module, I keep getting this error
-----
error: command 'gcc' failed with exit status 1
-----

the entire output -> http://dpaste.com/59232/

I have tried it on both my lap and my desktop, with 10.5.2 and dev
tools set up on both computers.

what gives

On Jun 11, 1:26 pm, tarun.pasr...@in.ibm.com wrote:
> Hi...
>
> The python driver works fine with MacOS and DB2. Please follow the
> steps below for installation of Python DB2 Driver on MacOS.
>
> Step - 1 :- Install the ThinCli Db2 driver on MacOS.
> Step - 2 :- You need to have setuptools installed to proceed with
> module setup.
> Step - 3 :- Export the following environment variables
>
> export PATH=<PYTHON_INSTALL_PATH>/bin:$PATH
> export IBM_DB_LIB=<DB2CLI_DRIVER_PATH>/lib
> export IBM_DB_DIR=<DB2CLI_DRIVER_PATH>
> export PYTHONPATH=<PYTHON_INSTALL_PATH>/lib/python2.5/site-packages/
> ibm_db-0.2.9-py2.5-macosx-10.3-i386.egg
> export LANG=en_US.UTF-8
>
> Step - 4 :- Download the latest driver source code and install.
>
> Step - 5 :- Run the following piece of code to validate.
>
> import ibm_db,sys
>
> conn_str =
> "DATABASE=databat;HOSTNAME=x.yourmachine.in.com;PORT=60000;PROTOCOL=TCPIP;U ID=db2inst1;PWD=password;"

tarun....@in.ibm.com

unread,
Jun 26, 2008, 7:57:07 AM6/26/08
to ibm_db
Hi

I got what the problem is. :) Actually while building the driver it
has a include file that it requires to build "sqlcli1.h" which is not
currently shipped with DB2 ThinCLI. A workaround for that is

1. From your DB2 Server, Copy sqllib/include directory into thincli
folder and rerun the install.
or
2. Download the EGG file from http://code.google.com/p/ibm-db/ and
install this. It has built in so files.

Try this out and let me know. Also It would be nice if you can tell us
something about your profile and organization that you work for. We
would be glad to have good customer relations.

Thank you for choosing our driver.

Bingimar

unread,
Jun 26, 2008, 9:18:14 AM6/26/08
to ibm_db
I put the clidriver folder from the ibm website in "/usr/local/
clidriver"

and then I did...

export IBM_DB_LIB=/usr/local/clidriver/lib
export IBM_DB_DIR=/usr/local/clidriver

I copied the sqlcli1.h file to the mac inside the clidriver folder

still get the same error.

tarun....@in.ibm.com

unread,
Jun 26, 2008, 1:01:20 PM6/26/08
to ibm_db
Did you copy the entire include folder..?

The sqlcli1.h itself needs other files too.. so as I mentioned
previously copy sqllib/include folder from the server and copy into
clidriver. The directory structure of clidriver would look like this

adm cfg db2dump lib
msg ruby32
bin conv include license
php32 security32

and the include folder that you see here is copied from db2server
sqllib/include. This contains the files

asn.h db2secPlugin.h sql1252a.h sqlca_92.f
sqlda.h sqle850a.h sqlenv.f sqlstate.f
sqlutil.h
db2ACSApi.h db2udbg.h sql1252b.f sqlca_cn.f
sqldact.f sqle850b.f sqlenv.h sqlstate.h
sqluv.h
db2ApiDf.f fsumplugin.h sql1252b.h sqlca_cs.f
sqle819a.f sqle850b.h sqlext.h sqlsystm.h
sqluvend.h
db2ApiDf.h gssapiDB2.h sqladef.h sqlcli.h
sqle819a.h sqle932a.f sqljacb.h sqlucompr.h
sqlxa.h
db2AuCfg.h sql.f sqlaprep.f sqlcli1.h
sqle819b.f sqle932a.h sqlmed.h sqludf.f
db2VendorApi.h sql.h sqlaprep.h sqlcodes.f
sqle819b.h sqle932b.f sqlmon.f sqludf.h
db2psmd.h sql1252a.f sqlca.h sqlcodes.h
sqle850a.f sqle932b.h sqlmon.h sqlutil.f


Please let me know if this works. It does on my Mac at least. :)

Bingimar

unread,
Jul 2, 2008, 7:25:10 AM7/2/08
to ibm_db
I'm getting so frustrated,

I have copied the include folder to the clidriver folder,
then I build the ibm_db python driver

From you post on june 11., setuptools in step 2, whats that and where
do I get it.


this is the error code i'm getting

ibm_db.c: In function 'ibm_db_get_option':
ibm_db.c:7043: warning: pointer targets in assignment differ in
signedness
ibm_db.c:7050: error: syntax error before 'value'
ibm_db.c: In function 'initibm_db':
ibm_db.c:7289: error: 'SQL_DECFLOAT' undeclared (first use in this
function)
ibm_db.c: In function 'initibm_db':
ibm_db.c:7289: error: 'SQL_DECFLOAT' undeclared (first use in this
function)
lipo: can't open input file: /var/folders/iW/iWNagy6+F6WlqsEvFWTfwE++
+TI/-Tmp-//ccplJH4D.out (No such file or directory)
error: command 'gcc' failed with exit status 1


tarun....@in.ibm.com

unread,
Jul 3, 2008, 5:52:13 AM7/3/08
to ibm_db
Hi

Please closely follow the following Installation process

1. Installing Python

$ tar -xzvf Python-2.5.1.tgz
$ cd Python-2.5.1/
$ ./configure --prefix= /home/xxxx/python
$ make clean
$ make all
$ make install
$ which python
$ echo $PATH
$ export PATH= /home/xxxx/python/bin:$PATH
$ export IBM_DB_LIB=/home/xxxx/clidriver/lib
$ export IBM_DB_DIR=/home/xxxx/clidriver
$ export PYTHONPATH=/home/xxxx/python/lib/python2.5/site-packages
$ export DYLD_LIBRARY_PATH=/home/xxxx/clidriver/lib
$ export LANG=en_US.UTF-8
$ which python
$ python

2. Installing Setuptools

Download setuptools from http://pypi.python.org/pypi/setuptools/

$ sh setuptools-0.6c8-py2.5.egg --prefix=/home/xxxx/python

3. Installing IBM_DB Driver

$ tar -xzvf ibm_db.tar.gz
$ python setup.py build
$ python setup.py install

This process works well for my Mac machine.

Thanks and Regards
Tarun Pasrija

tarun....@in.ibm.com

unread,
Jul 3, 2008, 6:03:07 AM7/3/08
to ibm_db
Hi..

IMPORTANT - There is a small bug which we would be fixing soon...

In IBM_DB folder after you untar it, there is a file as ibm_db.c

On line number 7289 you would find the following lines

PyModule_AddIntConstant(m, "SQL_DECFLOAT", SQL_DECFLOAT);
PyModule_AddIntConstant(m, "SQL_DECFLOAT", SQL_DECFLOAT);

Please comment out these lines before building your driver. This
feature is not supported in the current release.

After commenting out these lines, build your driver as mentioned.

Thanks and Regards
Tarun Pasrija

tarun....@in.ibm.com

unread,
Jul 11, 2008, 1:02:15 PM7/11/08
to ibm_db
Hi..

Any luck with the current Solution?

Thanks and Regards
Tarun Pasrija

Bingimar

unread,
Jul 14, 2008, 11:54:51 AM7/14/08
to ibm_db
no, I still get this gcc error.

tarun....@in.ibm.com

unread,
Jul 15, 2008, 6:48:48 PM7/15/08
to ibm_db
Hi..

I would make a release with some fixes. Please let me know if it still
fails. I would make the release by tomorrow.

Thanks and Regards

tarun....@in.ibm.com

unread,
Jul 16, 2008, 5:04:41 AM7/16/08
to ibm_db
Hi

Please use the latest version now to build. You can download it from

http://pypi.python.org/pypi/ibm_db

I believe the GCC error should go this time. If it doesn't please copy
me the error code.

Thanks and Regards

On Jul 14, 8:54 pm, Bingimar <bjarni.julius...@gmail.com> wrote:

Bingimar

unread,
Jul 20, 2008, 8:21:40 PM7/20/08
to ibm_db
Hi,

I sat down during the weekend to try the installation again on a fresh
machine.

...Prepping
--------------------------------------------
Mac mini, using leopard, clean install, dev tools installed

Download ibm_db-0.2.9.1.tar

Download ibm_db_sa-0.1.5.tar

Download IBM Data Server Driver for ODBC and CLI version 9.5 for MAC
OS X 32 Bit

Require the "sqllib/include" folder from the iSeries machine
--------------------------------------------

copy "include" into "clidriver"

$ mkdir /Users/admin/ibm

copy clidriver into /Users/admin/ibm

remove

"PyModule_AddIntConstant(m, "SQL_DECFLOAT", SQL_DECFLOAT);"
"PyModule_AddIntConstant(m, "SQL_DECFLOAT", SQL_DECFLOAT);"

from ibm_db.c, although only finding one line.

$ export IBM_DB_LIB=/Users/admin/ibm/clidriver/lib

$ export IBM_DB_DIR=/Users/admin/ibm/clidriver

$ export DYLD_LIBRARY_PATH=/Users/admin/bim/clidriver/lib

$ export LANG=en_US.UTF-8

-----$PATH's----
Macintosh:ibm_db-0.2.9.1 admin$ echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

Macintosh:ibm_db-0.2.9.1 admin$ echo $IBM_DB_LIB
/Users/admin/ibm/clidriver/lib

Macintosh:ibm_db-0.2.9.1 admin$ echo $IBM_DB_DIR
/Users/admin/ibm/clidriver

Macintosh:ibm_db-0.2.9.1 admin$ echo $PYTHONPATH
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/
site-packages

Macintosh:ibm_db-0.2.9.1 admin$ echo $DYLD_LIBRARY_PATH
/Users/admin/ibm/clidriver/lib

Macintosh:ibm_db-0.2.9.1 admin$ echo $LANG
en_US.UTF-8
-----------------

$ sh setuptools-0.6c8-py2.5.egg --prefix=/System/Library/Frameworks/
Python.framework/Versions/2.5

And now to the problem....

ibm_db driver

$ python setup.py build

terminal output -> http://dpaste.com/66304/

I was wondering, I talked to the ibm guys in Iceland and he sent me
the sql/include folder, although he wasn't sure it was the right one.
Can you describe it more, in what library is it installed?

tarun....@in.ibm.com

unread,
Jul 22, 2008, 10:48:01 AM7/22/08
to ibm_db
Hi

I have sent you the CLI distro. From the error output, i am skeptic
that the include files are not appropriate since it is not able to
find any of the CLI functions. Also it tries to locate windows.h which
it should not since yours is a MacBox. So try out replacing your
ThinCLI zip with this and let me know what happens.

The path settings done by you are correct. Just replace the clidriver
folder that you have in /Users/admin/ibm/clidriver with the one that I
have mailed you.

Thanks and Regards

Bingimar

unread,
Jul 22, 2008, 3:47:44 PM7/22/08
to ibm_db
fantastic, its working, everything installed now. Thanks

tarun....@in.ibm.com

unread,
Jul 22, 2008, 10:57:35 PM7/22/08
to ibm_db
Great.....

Am glad to hear that finally :) I believe that the CLI distribution
that you are using was not appropriate. So the python driver has no
problems.. :) Looking forward working with you. Keep us posted about
your experiences using the python driver. Also let us know if you
would like to have some enhancements done that you feel are important
and we would look into it.

Thanks and Regards
Tarun Pasrija

Bingimar

unread,
Jul 23, 2008, 6:52:16 AM7/23/08
to ibm_db
Hi,

i tried this script, without success.

DATABASE -> the database schema?
PORT -> shouln't this be 50000 for the db2?


import ibm_db,sys

conn_str =
"DATABASE=databat;HOSTNAME=x.yourmachine.in.com;PORT=60000;PROTOCOL=TCPIP;UID=db2inst1;PWD=password;"
try:
ibm_db_conn = ibm_db.connect(conn_str, ' ', ' ')
print "Connection Success"
print ibm_db_conn
except:
print "Error"



tarun....@in.ibm.com

unread,
Jul 23, 2008, 2:58:33 PM7/23/08
to ibm_db
Hi..

First.. I would encourage you to use the DSDriver download from the
website with include files in your I5 machine to work. Though it has
the same package structure but some things might crash since the one
that I have given you is not a complete version. Please send me the
link from where you downloaded the DSDriver for MacOSX and I would
verify the link and the downloads integrity for you. Then you can
delete the one that I have given you and use the one that would be
supported from IBM itself.

Second, for the following issue that you have reported,

Go to your I5 DB2 server machine and issue the following command

"cat /etc/services | grep db2"

Now from the output, use anyone of the ports that it mentions that
db2inst1 is running on. Most probably it must be 50000 or 60000. Try
it out and please do send me the link that you downloaded from so that
I can help you out with the same env settings on my Mac box.

On Jul 23, 3:52 pm, Bingimar <bjarni.julius...@gmail.com> wrote:
> Hi,
>
> i tried this script, without success.
>
> DATABASE -> the database schema?
> PORT -> shouln't this be 50000 for the db2?
>
> import ibm_db,sys
>
> conn_str =
> "DATABASE=databat;HOSTNAME=x.yourmachine.in.com;PORT=60000;PROTOCOL=TCPIP;U ID=db2inst1;PWD=password;"

Bingimar

unread,
Jul 23, 2008, 4:39:20 PM7/23/08
to ibm_db
hi,

DSDriver... are you talking about the cliDriver?

I used the one mentioned in the third post.

tarun....@in.ibm.com

unread,
Jul 24, 2008, 4:06:19 AM7/24/08
to ibm_db
Hey

If that is the same driver, then I believe that copying the include
folder into the clidriver directory from your I5 machine DB2 server
should work out of the box. I am not sure what went wrong in your
case. Can you try that out once more from your side? I mean using the
downloaded version of clidriver and copying the include folder in the
clidriver directory as I have done it and given it to you since I did
the same and it worked for me. If it works for you, then I would
appreciate that you use the one that is downloadable from the internet
since that would be more authentic and less prone to errors since that
is the version shipped to the customers.

Thanks and Regards
Tarun Pasrija

Bingimar

unread,
Jul 24, 2008, 7:09:30 PM7/24/08
to ibm_db
dsdriver? do you mean the clidriver? I used the one in the third post.

tarun....@in.ibm.com

unread,
Jul 24, 2008, 7:44:07 PM7/24/08
to ibm_db
Yes, they both are same. Please go through the prev post and try that
out and let me know if that works for you..

Thanks and Regards
Tarun Pasrija

Reply all
Reply to author
Forward
0 new messages