• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

accept command in .sql file not working from ant

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Don't listen to Steve. Just read this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic