wood burning stoves 2.0*
The moose likes Ant, Maven and Other Build Tools and the fly likes accept command in .sql file not working from ant Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "accept command in .sql file not working from ant" Watch "accept command in .sql file not working from ant" New topic
Author

accept command in .sql file not working from ant

Judit Raj
Greenhorn

Joined: Mar 22, 2011
Posts: 1
I am having a sql file (Grant_Priv.sql) with 'accept' command.
Grant_Priv.sql:
------------------
accept USER prompt "Enter schema name :"
grant connect to &USER;

Using ant i am connecting to SQL and executing the SQL file:
----------------------------------------------------------------------------
<exec executable="sqlplus" dir="">
<arg value="sys/sys as sysdba"/>
<arg value="@C:\test\tmp1\Grant_Priv.sql"/>
</exec>

when ant executes the sql file, it has to prompr the user for username. But it is not asking username in my case. Instead, it is connecting to sql, displaying the below line and getting disconnected from sql.

Output:
---------
[exec] Connected to:
[exec] Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
[exec]
[exec] Enter schema name: Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production
[echo] after exec
Main:

BUILD SUCCESSFUL
Total time: 2 seconds

Please help me how to make the sql file to prompt for username.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

RTFM: The first sentence of the second paragraph in the Ant docs on exec reads:

Ant Docs wrote:Note that you cannot interact with the forked program, the only way to send input to it is via the input and inputstring attributes.


http://ant.apache.org/manual/Tasks/exec.html

JBoss In Action
 
wood burning stoves
 
subject: accept command in .sql file not working from ant