Error occurred in SQL Call Level Interface SQLSTATE=HY009 SQLCODE=-99999

375 views
Skip to first unread message

Brian Kline

unread,
May 25, 2016, 7:32:21 AM5/25/16
to ibm_db
I am running Python 3.4.2 and ibm_db on an IBM i running 7.1.  I am new to Python and simply playing around with Python to see if it would be useful for us and am having issues with ibm_db.  I get the exception shown in the subject line.  I tried typing the lines out manually in interactive mode minus any IF/ELSE.  When I execute the close, true is returned so I at least know the connection is made.  I've tried using *LOCAL as well as the database name.  Both produce the same results.  I don't even know where to look to begin troubleshooting.  Any help would be appreciated and if you need more information, let me know and I will try to get it for you.  

My output is shown below and was executed through a PASE shell.  I have also included my script which is pretty simple.  I commented out quite a bit trying to figure out where the issue is. It sure doesn't seem like I should get an exception when I'm not really doing anything.  

Output:

>python3 exceldbtest.py                                                            

SQLConnect(2, database, -3, user, -3, password, -3)                             

Exec successfulTraceback (most recent call last):                                 

  File "exceldbtest.py", line 17, in <module>                                     

    print('Exec successful')                                                      

Exception: Error occurred in SQL Call Level Interface SQLSTATE=HY009 SQLCODE=-99999


Python Script:

import xlsxwriter
import ibm_db

# Create a workbook and add a worksheet.
#wb = xlsxwriter.Workbook('db2test.xlsx')

try:
    connection = ibm_db.connect('database','user','password')
except:
    msg = ibm_db.conn_errormsg()
    print(msg)
if connection:
    sql = 'select * from AULT4F2dev.app52 fetch first 10 rows only'
    stmt = ibm_db.exec_immediate(connection, sql)        

    if stmt:
        print('Exec successful')
        #print(ibm_db.num_fields(result))
        #i = 0
        #row = ibm_db.fetch_row(result)
        
        #while (row):
        
                     
            
            #print(ibm_db.result(result,i))
        #    i += 1
        #    row = ibm_db.fetch_row(result)
    else:
       print(ibm_db.stmt_errormsg())
else:
    print('Connection failed')


#ibm_db.free_result(result)    
ibm_db.free_result(stmt)
ibm_db.close(connection)
#wb.close()




Saba Kauser

unread,
May 25, 2016, 7:36:22 AM5/25/16
to ibm...@googlegroups.com, brk...@gmail.com
Hello,

Could you please do the following:

1. cd <cli driver install location>/cfg
    edit db2cli.ini and add the following entries:

hotel63: sakauser/sqllib/cfg> cat db2cli.ini

[common]
tracepathname=<path where you have write permissions to collect cli traces>
Trace=1


2. db2trc on -f trc.dmp
   <run your application>
   db2trc off

   db2trc flw trc.dmp trc.flw
   db2trc fmt trc.dmp trc.fmt
   db2trc fmt -c trc.dmp trc.fmtc


and share the trace files generated at 'tracepathname' path and trc.flw, trc.fmt and trc.fmtc.


Regards
_________________________________________
Saba Kauser
DB2 Common Application Development
India Software Labs- IBM
Bangalore

>python3 exceldbtest.py                                                            

    print('Exec successful')                                                      

Python Script:


--
You received this message because you are subscribed to the Google Groups "ibm_db" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
ibm_db+un...@googlegroups.com.
To post to this group, send email to
ibm...@googlegroups.com.
Visit this group at
https://groups.google.com/group/ibm_db.
For more options, visit
https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages