Closed GoogleCodeExporter closed 9 years ago
This error comes due to some problem in db2 environment variables setting.
So, run "/home/user/sqllib/db2profile" command it will set all the environment
variables of the DB2.
Try this and let me know this works for you or not.
Original comment by rahul.pr...@in.ibm.com
on 30 Apr 2010 at 7:29
Ok, thanks. Guess there's no /home/user/sqllib as there's no DB2 running
locally --
right?
But after these steps (making libraries available and downloading another one)
it
works now:
$ sudo nano /etc/ld.so.conf.d/db2.conf
/home/user/db2cli/lib
$ sudo ldconfig
$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: libstdc++.so.5: cannot open shared object file: No such file or
directory
>>> exit()
# so downloaded and installed
# http://ftp.debian.org/debian/pool/main/g/gcc-3.3/libstdc++5_3.3.6-18_i386.deb
# http://packages.debian.org/lenny/i386/libstdc++5/download
$ python
>>> import ibm_db_dbi
>>> conn =
ibm_db_dbi.connect("DATABASE=dbname;HOSTNAME=hostname;PORT=portnumber;PROTOCOL=T
CPIP;UID=username;PWD=password;",
"", "")
>>> curs = conn.cursor()
>>> curs.execute('select * from mytable')
Great!
Original comment by dblips@gmail.com
on 30 Apr 2010 at 8:06
Original comment by rahul.pr...@in.ibm.com
on 30 Apr 2010 at 8:14
I ran into the same issue on Debian Lenny (5.0.7). I have a full IBM DB2 9.7.2
server and client installation (instance installed under user db2inst1).
After installing python-dev and ibm-db using easyinstall, I also got:
ImportError: libdb2.so.1: cannot open shared object file: No such file or
directory
Then I did:
$ sudo nano /etc/ld.so.conf.d/db2.conf /home/db2inst1/sqllib/lib
$ sudo ldconfig
$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError:
/usr/lib/python2.5/site-packages/ibm_db-1.0.3-py2.5-linux-i686.egg/ibm_db.so:
undefined symbol: PyUnicodeUCS2_FromUnicode
>>>
Any help would be appreciated.
Regards,
Ben
Original comment by bba...@gmail.com
on 28 Dec 2010 at 2:10
You got this error because your Python on Debian Lenny build with 4 byte
unicode characters(UCS4) and the ibm_db egg you are using is UCS2 build.
You needs to download source code from "http://pypi.python.org/pypi/ibm_db".
There is a README file inside ibm_db folder follow those steps to build and
install ibm_db driver.
Before building and installing from source code, remove pre-installed ibm_db
egg from "/usr/lib/python2.5/site-packages/" and listing of this egg from
"/usr/lib/python2.5/site-packages/easy-install.path".
Thanks,
Rahul Priyadarshi
Original comment by rahul.pr...@in.ibm.com
on 29 Dec 2010 at 5:42
Thanks Rahul, that solved the issue.
Original comment by bba...@gmail.com
on 29 Dec 2010 at 7:47
[deleted comment]
There is something missing in the aforementioned README file for the source
build (applies to the easy_install process, too): it needs some header files to
compile (was getting an error looking for sqlcli1.h which was nowhere to be
found on my machine).
In the interest of helping poor souls like me who may stumble on this thread,
may I add that one can get that file by
a) downloading the IBM Data Server Driver package (I did it for fix 3a for DB
9.7 on linux 32-bit)
b) uncompressing and cd-ing to odbc_cli_drive/linuxia32
c) uncompressing the file therein ibm_data_server_driver_for_odbc_cli.tar.Z
d) cd-ing to clidriver/include
...file is there. The error log of the build/easy_install script says exactly
where it expects to find this file => move/link it...
Original comment by harr...@gmail.com
on 15 Apr 2011 at 9:12
I encountered yet another issue (on another machine). Python.h could not be
found. For that python-dev should be installed on the machine (say, via
Synaptic)
Original comment by harr...@gmail.com
on 22 Jun 2011 at 9:34
Yes, in some pre-installed python this problem comes.
This problem will gone away by installing python-dev package.
Original comment by rahul.pr...@in.ibm.com
on 23 Jun 2011 at 3:10
One may be able to avoid steps b) and c) in Comment 8 by running
installDSDriver (which creates an include dir etc)
The installation happens apparently in the same dir, so you may want to move
the whole shebang to /opt/ibm/db2/dsdriver (or anywhere, really), set
IBM_DB_DIR and IBM_DB_LIB appropriately and go from there.
Original comment by harr...@gmail.com
on 22 Jul 2011 at 10:59
Sorry, I've read the discussion but I can't get "sudo easy_install ibm_db"
working correctly. I've downloaded ODBC_CLI from ibm site and set the
IBM_DB_DIR & IBM_DB_LIB correctly, but it always returns:
"IBM DataServer environment not set.
Please set IBM_DB_DIR to path to sqllib,
and set IBM_DB_LIB to lib directory under sqllib
e.g. export IBM_DB_DIR=/home/db2inst1/sqllib
export IBM_DB_LIB=/home/db2inst1/sqllib/lib"
What can I do?
Original comment by davidefe...@gmail.com
on 3 Nov 2011 at 4:48
Issue following command "sudo -s" before exporting IBM_DB_DIR and IBM_DB_LIB
environment variables.
The error you are getting due to you had sets the environment variables for
current user not for sudo user.
Let me know if you still gets same error.
Original comment by rahul.pr...@in.ibm.com
on 15 Nov 2011 at 6:42
Original issue reported on code.google.com by
dblips@gmail.com
on 30 Apr 2010 at 6:39