vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I would like to call Stored Procedure using mxODBC DB2 driver(egenix) using Python. I used following Stored Procedure documentation. http://www.egenix.com/files/python/m...oredProcedures {{ Stored Procedures Even though mxODBC does not yet support the .callproc() API, it does allow calling stored procedures which return data using result sets. The ODBC syntax for calling a stored procedure is as follows: {call procedure-name [([parameter][,[parameter]]...)]} Using the above syntax, you can call stored procedures through one of the .executeXXX() calls, e.g. cursor.execute("{call myprocedure(?,?)}", (1,2)) will call the stored procedure myprocedure with the parameters 1, 2. }} I wrote the following script to call the stored procedure. from ODBC.DB2 import connect con = connect('sample') cur = con.cursor() cur.execute('''call xfz.procedure (?, ?) ''',#""" (parm1, parm2) ) cur.execute line returns me an error. I guess my syntax is not correct!!! Could anybody please show me the correct way of calling stored procedure in Python using above driver? I would be very much thankful if i get some working examples for the same. Thanks in Advance Pravir |
| ||||
| pravir_g@yahoo.com (Pravir) wrote in message news:<304c119b.0310070957.52d9fa66@posting.google. com>... > Hi, > > I would like to call Stored Procedure using mxODBC DB2 driver(egenix) > using Python. I used following Stored Procedure documentation. > http://www.egenix.com/files/python/m...oredProcedures > > {{ > Stored Procedures > Even though mxODBC does not yet support the .callproc() API, it does > allow calling stored procedures which return data using result sets. > The ODBC syntax for calling a stored procedure is as follows: > > {call procedure-name [([parameter][,[parameter]]...)]} > > Using the above syntax, you can call stored procedures through one > of the .executeXXX() calls, > e.g. cursor.execute("{call myprocedure(?,?)}", (1,2)) will call the > stored procedure myprocedure with the parameters 1, 2. > }} > > I wrote the following script to call the stored procedure. > > from ODBC.DB2 import connect > con = connect('sample') > cur = con.cursor() > cur.execute('''call xfz.procedure (?, ?) > ''',#""" > (parm1, parm2) > ) > > cur.execute line returns me an error. I guess my syntax is not > correct!!! Could anybody please show me the correct way of calling > stored procedure in Python using above driver? I would be very much > thankful if i get some working examples for the same. > > Thanks in Advance > Pravir ================================================== =================== I figured out the problem. I was using output parameter as one of the parameters in the call procedure argument, which is not supported by the mxODBC driver I have. I changed the stored procedure without output parameter in the argument and it worked. Thanks to everybody, who even tried to look at my question. Regards, Pravir Gandhi |
| Thread Tools | |
| Display Modes | |
|
|