ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Keith Hatton" <khat...@axiomsystems.com>
Subject RE: Newbie: <sql> task and executing an Oracle Stored Procedure
Date Mon, 16 Aug 2004 11:26:07 GMT
Richard,

"exec" is understood by SQL Plus, but it is not Oracle SQL so you can't use it from another
client such as the JDBC driver.

You might get more luck with either of the following:

1. Use an anonymous PL/SQL block
BEGIN myStoredProc(1); END;

2. Use the JDBC escape syntax
{CALL myStoredProc(1)}

I haven't tried them so I can't be certain, but I am fairly sure your problem is related to
this.

Hope this helps
Keith


-----Original Message-----
From: Richard Grey [mailto:haamdab@haamdhani.com]
Sent: 13 August 2004 17:20
To: user@ant.apache.org
Subject: Newbie: <sql> task and executing an Oracle Stored Procedure


Why can't I use the <sql> task to exec an Oracle stored procedure ?

<target name="test">
  <sql driver="${db.driver}" 
       url="${db.url}" 
       userid="${db.user}" 
       password="${db.pwd}" 
       classpath="${profileLibPath}/ojdbc14.jar"
       print="true"
       showheaders="true">

	exec myStoredProc(1);

  </sql>
</target>

All my driver settings etc are correct, in that I can replace the exec SQL above with a simple
select * from table type SQL command.

But, running the above task as is, gives me the following error. And yes, I am using 1.5.1
(for a reason).

--

Apache Ant version 1.5.1 compiled on October 2 2002
Buildfile: build.xml
test:
      [sql] connecting to jdbc:oracle:thin:@boreas:1555:prodevel
      [sql] Loading oracle.jdbc.driver.OracleDriver using AntClassLoader with classpath classpath
C:\build\lib\ojdbc14.jar
      [sql] Executing commands
      [sql] SQL: exec myStoredProc(1);
      [sql] Failed to execute: exec myStoredProc(1)

BUILD FAILED
file:C:/Profile5/build_borland/build.xml:524: java.sql.SQLException: ORA-00900: invalid SQL
statement

        at org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:406)

etc

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message