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 68483 invoked from network); 1 Nov 2000 06:07:31 -0000 Received: from unknown (HELO smtp.cortexebusiness.com.au) (203.174.140.214) by locus.apache.org with SMTP; 1 Nov 2000 06:07:31 -0000 Received: (from daemon@localhost) by smtp.cortexebusiness.com.au (8.10.0/8.10.0) id eA167SY28548; Wed, 1 Nov 2000 17:07:28 +1100 (EST) Received: from UNKNOWN(192.168.1.8), claiming to be "monkey.prod.thespot.com.au" via SMTP by ripley, id smtpdAAAe0aOS3; Wed Nov 1 17:06:04 2000 Received: (from daemon@localhost) by monkey.prod.thespot.com.au (8.10.0/8.10.0) id eA1663000505; Wed, 1 Nov 2000 17:06:03 +1100 (EST) Received: from UNKNOWN(192.168.1.9), claiming to be "chunky.devl.ebinteractive.com.au" via SMTP by monkey, id smtpdAAAPsaq.a; Wed Nov 1 17:05:53 2000 Received: from snotty (snotty.devl.ebinteractive.com.au [192.168.1.32]) by chunky.devl.ebinteractive.com.au (8.10.0/8.10.0) with SMTP id eA165rB20158; Wed, 1 Nov 2000 17:05:53 +1100 (EST) From: "Conor MacNeill" To: , Subject: RE: Ant sql task print Date: Wed, 1 Nov 2000 17:06:20 +1100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 In-reply-to: <06a601c043ae$f7de5ed0$7b032b0a@jp.fisci.com> X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N OK, I think I have fixed this. It now works under Oracle. Can someone check it under the other databases. The main change is to take the result of getMoreResults into account. Since this is returning false under Oracle, presumably you shouldn't call getResultSet(), although as I read the javadoc it should be OK. I also noticed that if I had two statements in the SQL, only the last is written to the file. I haven't fixed that yet. I did fix the printing of NULL columns though. Conor -- Conor MacNeill conor@cortexebusiness.com.au Cortex eBusiness http://www.cortexebusiness.com.au > -----Original Message----- > From: Julian M. Savage [mailto:jsavage@fisci.com] > Sent: Wednesday, 1 November 2000 13:53 > To: ant-user@jakarta.apache.org; ant-dev@jakarta.apache.org > Subject: Re: Ant sql task print > > > 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(S > QLExec.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 > > _________________________________________________ > > > > > > > >