having trouble with executemany() in ibm_db driver

1,046 views
Skip to first unread message

imbill...@gmail.com

unread,
Apr 13, 2013, 6:56:20 PM4/13/13
to ibm...@googlegroups.com
Hi, 

i'm having trouble with the executemany() function for the ibm_db driver.   I receive the following error:

Error: ibm_db_dbi::Error: 
Error 1: Binding Error 1: [IBM][CLI Driver] CLI0125E  Function sequence error. SQLSTATE=HY010 SQLCODE=-99999 


My sql statement is of the form:  
insert_many_sql = ("insert into myschema.mytable "
                                "(field1, field2, field3) "
                            "VALUES (?, current timestamp,?)")
my_rows = (('first1', 'second1'),
                  ('first2','second2'))

cursor.executemany(insert_many_sql, my_rows)

The first record seems to be stored -- but subsequent ones in the sequence create the error above.

Is this error familiar to anyone?   Does anyone have advice on how to get executemany() to work?


-Bill Tucker

Praveen

unread,
Apr 14, 2013, 12:25:09 AM4/14/13
to ibm...@googlegroups.com
Hi Bill,

Could you let us know the data types of the table columns. Also which version of DB2 and ibm_db driver are you on.

I tried the below sample program and it works fine. Is your program same as below or am I missing something.

#create table tabmany(id varchar(10), time timestamp,name varchar(10))

import ibm_db
ibm_db_conn = ibm_db.connect('pydb','user','password')
import ibm_db_dbi
conn = ibm_db_dbi.Connection(ibm_db_conn)

cur=conn.cursor()


sql="insert into tabmany (id,time,name) values (?,current timestamp,?)"

rows = (('first1', 'second1'), ('first2','second2'))
result = cur.executemany(sql, rows)
print "Executed"
cur.close()
conn.close()

Thanks

Praveen

Praveen

unread,
Apr 14, 2013, 12:32:04 AM4/14/13
to ibm...@googlegroups.com
 Bill,

Also, could you get us the CLI trace for your program run. To obtain CLI trace refer to http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.admin.trb.doc/doc/c0008936.html

Thanks

Praveen
Reply all
Reply to author
Forward
0 new messages