From jsavage@fisci.com Wed Nov 1 02:55:57 2000 Return-Path: Mailing-List: contact ant-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-user@jakarta.apache.org Received: (qmail 89278 invoked from network); 1 Nov 2000 02:55:57 -0000 Received: from mail.fisci.com (HELO fschp04.fisci.com) (216.32.221.253) by locus.apache.org with SMTP; 1 Nov 2000 02:55:57 -0000 Received: from vancouver ([10.43.3.123]) by fschp04.fisci.com (8.9.3 (PHNE_21697)/8.9.3) with SMTP id VAA10340; Tue, 31 Oct 2000 21:54:10 -0500 (EST) Message-ID: <06a601c043ae$f7de5ed0$7b032b0a@jp.fisci.com> From: "Julian M. Savage" To: , References: Subject: Re: Ant sql task print Date: Wed, 1 Nov 2000 11:53:15 +0900 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N 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 > _________________________________________________ > > >