wmjie / ibm-db

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

No exception on SQL0668N Operation not allowed for reason code "7" on table SQLSTATE=57016 #91

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Steps to reproduce the problem:

1. ALTER a table big enough to need a REORG TABLE but do not run the REORG on it
            alter table t1 alter column col1 set data type varchar(64)

2. Connect to database using python ibm_db_dbi module
3. execute any SELECT command on the table, "SELECT COUNT(*) FROM t1"

Expected output:

a Python exception containing at least SQL CODE and SQL STATE:
SQL0668N  Operation not allowed for reason code "7" on table  SQLSTATE=57016 

Actual result:

cursor.execute() returns True
rs = cursor,fetchone() returns None
no error message

What version of the product are you using? On what operating system?

ibm module compiled for Linux X86_64
ibm_db-1.0.5-py2.7-linux-x86_64.egg

Steps to compile module on OpenSuse 11.4 64 bits:

Python ibm_db module compilation
--------------------------------
zypper in python-devel
zypper in python-setuptools

# db2inst1 is the owner of db2 instance 1, make sure it matches yours and if 
not change to a valid instance owner home
export IBM_DB_DIR=/home/db2inst1/sqllib
export IBM_DB_LIB=/home/db2inst1/sqllib/lib
easy_install ibm_db

test installation
python
>>> import ibm_db_dbi
>>> conn 
=ibm_db_dbi.connect("DATABASE=TEST;HOSTNAME=localhost;PORT=50002;PROTOCOL=TCPIP;
UID=db2user;PWD=bigsecret;","", "")
>>> cursor = conn.cursor()
>>> cursor.execute('SELECT * FROM t1')
>>> cursor.fetchall()

If this error appears:
ibm_db.h:15:21: fatal error: sqlcli1.h: No such file or directory 

follow the procedure below (see 
http://code.google.com/p/ibm-db/issues/detail?id=53#8)

* download IBM Data Server Driver Package (DS Driver) Version 9.7, untar

cd ~/builds/ibm-src/dsdriver/odbc_cli_driver/linuxamd64/clidriver/include/
cp *.h /opt/ibm/db2/V9.7/include

*  configure libraries, see 
http://code.google.com/p/ibm-db/issues/detail?id=53#4
vi /etc/ld.so.conf.d/db2.conf

* add to/etc/ld.so.conf.d/db2.conf:
/home/db2inst1/sqllib/lib

* execute as root
ldconfig

* run 'easy_install ibm_db' again and test installation

Original issue reported on code.google.com by south.mi...@gmail.com on 28 Nov 2011 at 5:17

Attachments:

GoogleCodeExporter commented 9 years ago
please send us the CLI Trace file for issue. This will help us in understanding 
the actual issue.

If you don't know how to tak CLI Trace then refer following link 
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=/com.ibm.db
2.luw.apdv.cli.doc/doc/c0007645.html 

Original comment by rahul.pr...@in.ibm.com on 29 Nov 2011 at 9:06

GoogleCodeExporter commented 9 years ago
The link you sent me says nothing about tracing :P
I have this in the db2cli.ini but doesn't seem to be capturing the python
activity as I don't see the queries in /tmp/db2-odbc-trace.log

[COMMON]
Trace=1
TraceFileName=/tmp/db2-odbc-trace.log
;network request information is captured
TraceComm=1
TraceFlush=1
TraceTimeStamp=3
; Only trace dynamic SQL statements in the CLI/ODBC trace
TraceStmtOnly=0

Anything else I can do just let me know.

best

Original comment by south.mi...@gmail.com on 29 Nov 2011 at 2:56

GoogleCodeExporter commented 9 years ago
Sorry for the wrong link, the correct link is 
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/topic/com.ibm.db2.luw.apdv.
cli.doc/doc/c0007959.html 

Your db2cli.ini file is correct but it looks like your DB2CLIINIPATH 
environment variable doesn't have the correct path of the directory where your 
local db2cli.ini file resides.

Please issue following command "db2 get cli cfg" to verify current CLI cfg 
values.

Original comment by rahul.pr...@in.ibm.com on 2 Dec 2011 at 10:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
The fix has been released with ibm_db-1.0.6

Original comment by rahul.pr...@in.ibm.com on 26 May 2012 at 6:08