Apache OpenOffice (AOO) Bugzilla – Issue 109328
Statements must been closed after calling a Stored Porcedure in MySQL
Last modified: 2013-01-29 21:47:20 UTC
Using MySQL natice connector trye this code SUB TESTstoredprocedurecall oBaseContext = CreateUnoService("com.sun.star.sdb.DatabaseContext") oDB = oBaseContext.getByName("mysql_native") oCon = oDB.getConnection("user", "Password") oStatement = oCon.createStatement() sSQL1 = "call teststoredprocedure('Parm1', '¨Parm2')" ' must been pased in right order ostatement.execute(sSQL1)' gives True oResultset1 = ostatement.getresultset oResultSet1.next print oResultset1.getstring(1)' confirmes the selection based on parameters ostatement.close ' must been done otherwise we ran in a Exception:'sdbc.SQLExepetion "Commands out of sync, you can not run this command now" 'after this exception you need to restart OO or dispose oDB ocon.close ' just to be sure everyting isclosed end sub this Exception "Commands out of sync, you can not run this command now" make the use of "PreparedStatements" useless
@sos what you describe is true, but I'm not at all sure this is a defect. The requirment to close your server side cursors is TTBOMK required. having to do so explicitly is IMO the norm (Basic Python Java), although in some environments, particular web based tools this requirement may be handled by a library and you may not explicitly have to manage this.
@Drew OK but if we need to do that also with a PreparedStatement ? and later (when thins works) also with a "preparedcall" ? It makes the "prepare" things useless no ?