ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Samson, Lyndon [IT]" <lyndon.sam...@ssmb.com>
Subject RE: <SQL /> and property as query
Date Wed, 25 Jul 2001 17:01:05 GMT
Property substitution only works in attributes.

-----Original Message-----
From: eg344@HOMEMAIL.nyu.edu [mailto:eg344@HOMEMAIL.nyu.edu]
Sent: Wednesday, July 25, 2001 5:46 PM
To: ant-user@jakarta.apache.org
Subject: <SQL /> and property as query 


Hello, i'm trying to build a target to execute arbitrary sql statements, 
and it looks like this:
   <target name="sql">
      <echo message="Executing '${sql.query}' on ${sql.url} as 
${sql.userid}" />
      <sql
          driver="${sql.driver}"
          url="${sql.url}"
          userid="${sql.userid}"
          password="${sql.password}"
          print="yes"
          output="${sql.output}"
      >
          ${sql.query}

      </sql>
   </target>


${sql.query} is select count(*) from schema.table, that's all!!

All the ${} are gotten from a property file, and all work fine except for 
the actual  ${sql.query}, where i get:
BUILD FAILED

Path:\build.xml:75: java.sql.SQLException: Non supported SQL92 token at
positio
n: 5: sql
--- Nested Exception ---
java.sql.SQLException: Non supported SQL92 token at position: 5: sql
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
         at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:829)
         at oracle.jdbc.driver.OracleSql.handleToken(OracleSql.java:152)
         at oracle.jdbc.driver.OracleSql.handleODBC(OracleSql.java:112)
         at oracle.jdbc.driver.OracleSql.parse(OracleSql.java:64)
         at 
oracle.jdbc.driver.OracleConnection.nativeSQL(OracleConnection.java:766)
         at 
oracle.jdbc.driver.OracleStatement.expandSqlEscapes(OracleStatement.java:479
0)
         at 
oracle.jdbc.driver.OracleStatement.parseSqlKind(OracleStatement.java:4779)
         at 
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java
:1847)
         at 
oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:737)
         at org.apache.tools.ant.taskdefs.SQLExec.execSQL(SQLExec.java:506)
         at 
org.apache.tools.ant.taskdefs.SQLExec.runStatements(SQLExec.java:448)
         at 
org.apache.tools.ant.taskdefs.SQLExec$Transaction.runTransaction(SQLExec.jav
a:607)
         at 
org.apache.tools.ant.taskdefs.SQLExec$Transaction.access$000(SQLExec.java:59
2)
         at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:377)
         at org.apache.tools.ant.Target.execute(Target.java:153)
         at org.apache.tools.ant.Project.runTarget(Project.java:898)
         at org.apache.tools.ant.Project.executeTarget(Project.java:536)
         at org.apache.tools.ant.Project.executeTargets(Project.java:510)
         at org.apache.tools.ant.Main.runBuild(Main.java:421)
         at org.apache.tools.ant.Main.main(Main.java:149)

Total time: 1 second

if i replace ${sql.query} with ${blah.query} i get the same as above:
Non supported SQL92 token at position: 5: blah

if i replace the ${sql.query} with the actual query, it works perfectly 
fine. Please help

thanx

eg

Mime
View raw message