Hi, the problem seems to be that Mono calls SQLPrepare before binding parameters
Bartolomeo Nicolotti wrote: >As you can see from here: > >http://www.itjungle.com/mgo/mgo120503-story01.html > >the code I've written in mono should be ok. The link above is an example in >visual basic .net on windows, I'm using mono on linux. > > > Ok, but the log shows a error coming back from the driver where one should not occur, so I suggest the problem lies with the driver. All unixODBC is doing at this point is passing the call from the app to the driver. Try executing the same call in isql. {CALL GIANLUCA.Provacs( ? )} it should fail to SQLExecute it, but if the driver is working as expected, the SQLPrepare should succeed. It may be that your DB2 driver requires the parameters to a SQLPrepare on a stored procedure to be bound before calling prepare, but if it does, and the mono code only binds after calling SQLPrepare then all you can do is change the code in mono, or use a different driver. http://www.nabble.com/inputOutput-parameter-problem-in-calling-stored-Procedure-td22002537.html Bartolomeo Nicolotti wrote: > > Hi, > > I'm trying unixodbc with System.Data.ODBC to access DB2 for iseries > > I can do select, see this file > http://www.nabble.com/file/p21997635/helloODBC.cs helloODBC.cs , but I've > some problems with out parameters of stored procedueres. > > With this file http://www.nabble.com/file/p21997635/helloODBCCommand.cs > helloODBCCommand.cs I get: > > Hello, Dunkel > Eseguo:CALL QGPL.WBC022(9) > Eseguo:CALL GIANLUCA.PROVACS > System.Data.Odbc.OdbcException: ERROR [42000] [unixODBC][IBM][iSeries > Access ODBC Driver][DB2 UDB]SQL0104 - Token GIANLUCA non valido. Token > validi: ( END GET SET CALL DROP FREE HOLD LOCK OPEN WITH ALTER. > > > It seems that setting the CommandType to StoredProcedure has no effect, as > one can also see from the source of mono (I've installed mono from source) > > /home/siap/dwn/src/mono/mono-2.2/mcs/class/System.Data/System.Data.Odbc/OdbcCommand > > the ExecuteNonQuery member function call ExecSQL that > > > private int ExecuteNonQuery (bool freeHandle) > { > ... > ExecSQL(CommandText); > > ExecSQL is: > > private void ExecSQL (string sql) > { > OdbcReturn ret; > if (! prepared && Parameters.Count <= 0) { > > ReAllocStatment (); > > ret = libodbc.SQLExecDirect (hstmt, sql, > libodbc.SQL_NTS); > if ((ret != OdbcReturn.Success) && (ret != > OdbcReturn.SuccessWithInfo) && > (ret != OdbcReturn.NoData)) > throw > connection.CreateOdbcException (OdbcHandleType.Stmt, hstmt); > return; > } > > if (!prepared) > Prepare(); > > BindParameters (); > ret = libodbc.SQLExecute (hstmt); > if (ret != OdbcReturn.Success && ret != > OdbcReturn.SuccessWithInfo) > throw connection.CreateOdbcException > (OdbcHandleType.Stmt, hstmt); > } > > Should I use prepared to BindParameters? > > How can I get the output parameter of a Stored Procedure? > > Many thanks > > Best regards > -- View this message in context: http://www.nabble.com/StoredProcedure-Output-Parameters-System.Data.Odbc-tp21997635p22035240.html Sent from the Mono - General mailing list archive at Nabble.com. _______________________________________________ Mono-list maillist - Mono-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-list