Johan, I added the ability to do printing from this task, and it works fine for me, using Sybase (I use it on a regular basis). I think that Stefan tested it with FreeTDS, Interbase and DB2 before he cleaned it up and checked it in. I don't know what to suggest, except I'm curious to know if this problem occurs when you don't try to print the results. As another point, I did notice when reviewing the code that this task doesn't close the PrintStream if there is an IOException, which I understand from traffic on the developers list might be a particular problem for Windows users (and perhaps is bad form even under unix). Fixing this would be a two line change I guess - just move the close of out from within the finally clause to just after the while() loop, like this: Index: SQLExec.java =================================================================== RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/SQLExec.j ava,v retrieving revision 1.9 diff -u -r1.9 SQLExec.java --- SQLExec.java 2000/09/29 15:51:13 1.9 +++ SQLExec.java 2000/11/01 02:38:12 @@ -548,10 +548,8 @@ catch (IOException ioe) { throw new BuildException("Error writing " + output.getAbsolutePath(), ioe, location); } - finally { - if (out != null && out != System.out) { - out.close(); - } + if (out != null && out != System.out) { + out.close(); } } Julian. ----- Original Message ----- From: "Johan Adelöw" To: "ant user mailing list" Sent: Tuesday, October 31, 2000 9:38 PM Subject: Ant sql task print > There must be som kind of bug in the printResults() method in the sql task i > ant. > > A simple sql statement that returns a table name and writes it to file (like > below) > > url="jdbc:oracle:thin:@dogbert:1521:repbld" userid="rep" password="rep" > showheaders="false" print="true" > output="print.txt"> > select table_name from user_tables where table_name > like '%OGO_DATA%' ; > > > Results in the following error: > > > BUILD FAILED > > test.xml:11: java.sql.SQLException: ORA-01009: missing mandatory parameter > > java.sql.SQLException: ORA-01009: missing mandatory parameter > > at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java) > at oracle.jdbc.ttc7.Oall7.receive(Oall7.java) > at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java) > at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java) > at oracle.jdbc.driver.OracleResultSet.next(OracleResultSet.java) > at > org.apache.tools.ant.taskdefs.SQLExec.printResults(SQLExec.java:539) > at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLExec.java:496) > at > org.apache.tools.ant.taskdefs.SQLExec.runStatements(SQLExec.java:425) > at > org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction(SQLExec.jav > a:592) > at > org.apache.tools.ant.taskdefs.SQLExec$Transaction.access$0(SQLExec.java:589) > at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:366) > at org.apache.tools.ant.Target.execute(Target.java:142) > at org.apache.tools.ant.Project.runTarget(Project.java:818) > at org.apache.tools.ant.Project.executeTarget(Project.java:532) > at org.apache.tools.ant.Project.executeTargets(Project.java:506) > at org.apache.tools.ant.Main.runBuild(Main.java:420) > at org.apache.tools.ant.Main.main(Main.java:149) > > It seems that when the writing to file is finished the statement > "rs = statement.getResultSet()) != null" should be null but > isn't (525) and when doing > "rs.next()" (539) the program fails. > > Does any body konw anything about this? Is the print function of the sql > task tested by anyone? > > > > ************************************************* > > ________________________________________________ > > E-mail: johan.adelow@corustechnologies.com > Direct: +46-8-678 80 60 > Mobile: +46-70-563 13 97 > Office: +46-8-4403860 (Always open) > Home page: www.corustechnologies.com > _________________________________________________ > > >