aspose file tools
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
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Reply 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: 5532

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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: accept command in .sql file not working from ant
 
Similar Threads
sqlplus
Oracle procedure works in direct SQL but not via Java
sqlplus problem in antinstaller
Insert or Update (Hibernate JPA + Jboss 5.0.0GA)
how to change port number of Oracle 10g xe