ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nagarajan Murugesan <NMURUGE...@Selectica.com>
Subject problem in executing sql statements under foreach task
Date Wed, 13 Aug 2003 05:41:51 GMT
Hai Friends,
I need a help from you all.
I have two questions.

1. I am trying to execute set of sql files present in a directory one by one
using foreach task. my test code is like this. How can I pass
(properties)variables defined in the other targets.
i.e ${driver}, ${durl}.... or is there any way to acheieve that?

<taskdef name="interactive"
classname="com.kasisoft.ant.interactive.Interactive"/>
<target name="getuserinput">
<interactive verbose="off">
	
<input property ="driver" text="Database Driver" type="string"
value="oracle.jdbc.driver.OracleDriver"/>
<input property="durl" text="Driver URL" type="string"
value="jdbc:oracle:thin:@localhost:1521:orcl"/>
<input property="dbuname" text="User Name" type="string" value="cdm"/>
<input property="dbupass" text="PassWord" type="string" value="cdm"/>
</interactive>
</target>

<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<target name="test">
   <foreach param="myparam" target="sqlrun">
         <path>
         <fileset dir="D:\orac" includes="*.sql"/>
         </path>   
   </foreach>      
</target>
	
<target name="sqlrun">
	<echo>Called with ${myparam}</echo>
	<sql onerror="continue" driver="${driver}" url="${durl}"
userid="${dbuname}" password="${dbupass}" >
  	<transaction  src="${myparam}"/>
	</sql>
</target>

The echo command gives correct result, but when its trying to execute sql
file it throws
Class Not Found: JDBC driver ${driver} could not be loaded error. ( I am
sure, I have added neccessary jar files in the
class path)


2. My second question is can we control the order of execution, i.e by
alphatical or parent directoty 
first then sub directoy and so any attributes for that is available?

Thanks & Regards,
Nagarajan M.




Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message