Open GoogleCodeExporter opened 9 years ago
Added the constant to ibm_db.c and ibm_db_dbi.py and installed the module but
did not work
# ibm_db.c
PyModule_AddIntConstant(m, "SQL_ATTR_INFO_PROGRAMNAME",
SQL_ATTR_INFO_PROGRAMNAME);
# ibm_db_dbi.py
SQL_ATTR_INFO_PROGRAMNAME = ibm_db.SQL_ATTR_INFO_PROGRAMNAME
The constant looks like correctly added
Python 2.6.8 (unknown, May 29 2012, 22:30:44)
[GCC 4.3.4 [gcc-4_3-branch revision 152973]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ibm_db_dbi
>>> ibm_db_dbi.__version__
'2.0.4.1'
>>> ibm_db_dbi.SQL_ATTR_INFO_PROGRAMNAME
2516
Original comment by south.mi...@gmail.com
on 12 Dec 2013 at 3:55
SQL_ATTR_INFO_PROGRAMNAME need to be set before the connection establish, after
that you can't be set this.
To set SQL_ATTR_INFO_PROGRAMNAME connection attribute you need to pass it in
conn_option as follows
>>>
opt = {ibm_db_dbi.SQL_ATTR_INFO_PROGRAMNAME : 'luis_app'}
conn = ibm_db_dbi.connect("db2", conn_options=opt)
<<<
Thanks,
Rahul
Original comment by rahul.pr...@in.ibm.com
on 13 Dec 2013 at 11:27
Thanks Rahul, it worked! The code in the previous comment worked with
my patched version of the module and failed on the unmodified one.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'SQL_ATTR_INFO_PROGRAMNAME'
The code below works with the unmodified version, 1.0.6 in my test.
<ibm_db_dbi.Connection object at 0x7e3750>
Any plans to add the constant on future versions?
Best
Luis
Original comment by south.mi...@gmail.com
on 13 Dec 2013 at 12:44
I will add this constant to our next release, but I will add it for ibm_db
driver only. This should not create any problem to you since it is accessible
to program as following manner
>>>
import ibm_db
opt = {ibm_db.SQL_ATTR_INFO_PROGRAMNAME : 'luis_app'}
conn = ibm_db_dbi.connect("db2", conn_options=opt)
<<<
Original comment by rahul.pr...@in.ibm.com
on 16 Dec 2013 at 9:23
Thanks. It also accessible as below, right?
import ibm_db_dbi
opt = {ibm_db_dbi.ibm_db.SQL_ATTR_INFO_PROGRAMNAME : 'luis_app'}
Original comment by south.mi...@gmail.com
on 16 Dec 2013 at 12:45
FYI, programName = PID on db2cli.ini seems to conflict with my compiled version
of the module and causes a segmentation fault
segfault at 0 ip 00007ffff34c698e sp 00007fffffffb058 error 6 in libdb2.so.1[7ffff2efb000+15b6000]
The module works well if programName option is not present.
Original comment by south.mi...@gmail.com
on 16 Dec 2013 at 1:58
Original issue reported on code.google.com by
south.mi...@gmail.com
on 12 Dec 2013 at 2:41