You have to specifically configure MySQL to allow multiple queries.
google for "mysql jdbc allowMultiQueries" for specifics. Larry On 4/19/07, Maarten Meijer <[EMAIL PROTECTED]> wrote:
Hi Larry, It's mysql with mysql-connector-java-3.1.14-bin.jar as driver. Maybe I should wrap them in <statement> rather than <select>? > If the jdbc driver allows it, it should work fine. Looks like yours > does not. > > What's the database, maybe there are alternatives/workarounds. > > Larry > > > On 4/17/07, Maarten Meijer <[EMAIL PROTECTED]> wrote: > >> Can I do the following to make a single clean up query for after unit >> testing: >> >> <sqlMap namespace="junit"> >> <!-- then do the special SQL operations for unit testing --> >> <select id="countEmpty" resultClass="java.lang.Integer"> >> SELECT count(*) FROM `lqueries` WHERE q_nresults = 0 AND >> q_ID > #firstProject# AND >> q_ID <= #lastProject#; >> </select> >> <select id="restoreTables" resultClass="java.lang.Integer"> >> DELETE FROM `lqueries` WHERE q_ID > #firstProject#; >> DELETE FROM `lresults` WHERE r_ID > #firstProject#; >> ALTER TABLE `lqueries` AUTO_INCREMENT = #firstProject#; >> </select> >> </sqlMap> >> >> If I try this, I get the following error message because of an >> SQLException: >> >> junit.framework.AssertionFailedError: restoreTables() : >> --- The error occurred in com/fold1/dbtest/sqlmap/maps/UnitTests.xml. >> --- The error occurred while applying a parameter map. >> --- Check the junit.restoreTables-InlineParameterMap. >> --- Check the statement (query failed). >> --- Cause: java.sql.SQLException: You have an error in your SQL >> syntax; check the manual that corresponds to your MySQL server >> version for the right syntax to use near '; DELETE FROM >> `lresults` WHERE r_ID > 6672; ALTER TABLE `lquerie' at line 1 >> >> Is there a workaround whereby I can leave/hide all my SQL clean up >> statements in the SqlMap and call them as a single unit from Java? >> >> Maarten >