waliwali / ibm-db

Automatically exported from code.google.com/p/ibm-db
0 stars 0 forks source link

Please help installing on Ubuntu #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
user@machine:~$ sudo apt-get install python-dev

Setting up python2.6-dev (2.6.5-1ubuntu6) ...
Setting up python-dev (2.6.5-0ubuntu1) ...

user@machine:~$ sudo easy_install ibm_db
Searching for ibm-db
Reading http://pypi.python.org/simple/ibm_db/
Reading http://code.google.com/p/ibm-db/downloads/list
Best match: ibm-db 1.0.2
Downloading http://pypi.python.org/packages/source/i/ibm_db/ibm_db-1.0.2.tar.gz
Processing ibm_db-1.0.2.tar.gz
Running ibm_db-1.0.2/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-jB11_3/ibm_db-1.0.2/egg-dist-tmp-BA_wFQ
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

No eggs found in /tmp/easy_install-jB11_3/ibm_db-1.0.2/egg-dist-tmp-BA_wFQ
(setup script problem?)

# --
# IBM Data Server Driver for ODBC and CLI (Linux/x86-32 32 bit) V9.5 Fix
Pack 5 
#
http://delivery04.dhe.ibm.com/sar/CMA/IMA/00rih/0/v9.5fp5_linuxia32_odbc_cli.tar
.gz
# extracting to /home/user/db2cli [adm  bin  bnd  cfg  conv  db2dump 
include  lib  license  msg  security32]
# --

user@machine:~/db2cli/lib$ export IBM_DB_DIR=/home/user/db2cli
user@machine:~/db2cli/lib$ export IBM_DB_LIB=/home/user/db2cli/lib

user@machine:~/db2cli/lib$ sudo easy_install ibm_db

No eggs found in /tmp/easy_install-dj34od/ibm_db-1.0.2/egg-dist-tmp-kOz82x
(setup script problem?)

user@machine:~/db2cli/lib$ sudo -E easy_install ibm_db
Searching for ibm-db
Reading http://pypi.python.org/simple/ibm_db/
Reading http://code.google.com/p/ibm-db/downloads/list
Best match: ibm-db 1.0.2
Downloading
http://pypi.python.org/packages/source/i/ibm_db/ibm_db-1.0.2.tar.gz#md5=99faac97
90fd1e180c37208e7b67da44
Processing ibm_db-1.0.2.tar.gz
Running ibm_db-1.0.2/setup.py -q bdist_egg --dist-dir
/tmp/easy_install-gwH3hd/ibm_db-1.0.2/egg-dist-tmp-xH_2XJ
In file included from /home/user/db2cli/include/sqlcli.h:848,
                 from /home/user/db2cli/include/sqlcli1.h:45,
                 from ibm_db.h:15,
                 from ibm_db.c:27:
/home/user/db2cli/include/sqlext.h:2014: warning: function declaration
isn’t a prototype
/home/user/db2cli/include/sqlext.h:2016: warning: function declaration
isn’t a prototype
/home/user/db2cli/include/sqlext.h:2034: warning: function declaration
isn’t a prototype
ibm_db.c: In function ‘_python_ibm_db_bind_data’:
ibm_db.c:4576: warning: null argument where non-null required (argument 1)
ibm_db.c:4576: warning: null argument where non-null required (argument 1)
zip_safe flag not set; analyzing archive contents...
testfunctions: module MAY be using inspect.stack
tests: module references __file__
tests.test_144_BindParamInsertStmtPARAM_FILE: module references __file__
tests.test_000_PrepareDb: module references __file__
Adding ibm-db 1.0.2 to easy-install.pth file

Installed
/usr/local/lib/python2.6/dist-packages/ibm_db-1.0.2-py2.6-linux-i686.egg
Processing dependencies for ibm-db
Finished processing dependencies for ibm-db

user@machine:~/db2cli/lib$ 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: libdb2.so.1: cannot open shared object file: No such file or
directory
>>> 

Original issue reported on code.google.com by dblips@gmail.com on 30 Apr 2010 at 6:39

GoogleCodeExporter commented 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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago

Original comment by rahul.pr...@in.ibm.com on 30 Apr 2010 at 8:14

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
Thanks Rahul, that solved the issue.

Original comment by bba...@gmail.com on 29 Dec 2010 at 7:47

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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