ANT and SQLPlus

View: New views
3 Messages — Rating Filter:   Alert me  

ANT and SQLPlus

by Mike Stewart :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am trying to execute a SQLPlus script from ANT and have been unable to
get this to work when the SQLPlus script requires user input as in the
example below:



If I execute the ANT target Create:

<target name="Create" >
        <exec executable="cmd" >
                <arg value="/K" /> Note have also tried the
/C, /c, /k value  here but have the same result
                <arg value="Create.bat" />
        </exec>
</target>


Where Create.bat contains the following line:


SQLPlus "SYS/sys@DEMODB AS SYSDBA" @\newuser.sql


Everything is ok until the newuser.sql requires an input, at this point
SQLPlus exits without waiting for the prompt:

     [exec] Please input spool name. No file extension required (i.e.
DBC_SCR12345)   >> Disconnected from Oracle9i Ente
rprise Edition Release 9.2.0.6.0 - Production




If the Create.bat is run from the command line it waits for the input
and executes as expected.

 I've tried various combinations including running SQLPlus in place of
the cmd executable in ANT and had the same effect.
Any ideas?


Mike S.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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


Re: ANT and SQLPlus

by geezenslaw :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, if u don't get a better answer from one of the ant gurus u might want to try: expect. it appears from the script file extension (.bat) u r using windows so get expect for windows. HTH.

Mike Stewart wrote ..

> I am trying to execute a SQLPlus script from ANT and have been unable to
> get this to work when the SQLPlus script requires user input as in the
> example below:
>
>
>
> If I execute the ANT target Create:
>
> <target name="Create" >
> <exec executable="cmd" >
> <arg value="/K" /> Note have also tried the
> /C, /c, /k value  here but have the same result
> <arg value="Create.bat" />
> </exec>
> </target>
>
>
> Where Create.bat contains the following line:
>
>
> SQLPlus "SYS/sys@DEMODB AS SYSDBA" @\newuser.sql
>
>
> Everything is ok until the newuser.sql requires an input, at this point
> SQLPlus exits without waiting for the prompt:
>
>      [exec] Please input spool name. No file extension required (i.e.
> DBC_SCR12345)   >> Disconnected from Oracle9i Ente
> rprise Edition Release 9.2.0.6.0 - Production
>
>
>
>
> If the Create.bat is run from the command line it waits for the input
> and executes as expected.
>
>  I've tried various combinations including running SQLPlus in place of
> the cmd executable in ANT and had the same effect.
> Any ideas?
>
>
> Mike S.
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@...
> For additional commands, e-mail: user-help@...

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


Parent Message unknown Re: ANT and SQLPlus

by Chuck Holzwarth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You may want to use anforms to prompt for the values to feed in and create the bat file with the required inputs before you call it. My experience with the exec command is that it is attached to ant and not the keyboard. When it attempts to get input, there is none and it would exit or hang, depending on the program exec'd. I have had to use antforms to prompt for values for variables, create a bat file that includes the variables, execute the bat file and delete the bat file when I didn't want the information available as an artifact.
 
Thank you,
Chuck Holzwarth
(804) 403-3478 (home)
(540) 335-3171 (cell)

----- Original Message ----
From: Mike Stewart <MStewart@...>
To: user@...
Sent: Wednesday, April 23, 2008 6:43:21 AM
Subject: ANT and SQLPlus

I am trying to execute a SQLPlus script from ANT and have been unable to
get this to work when the SQLPlus script requires user input as in the
example below:



If I execute the ANT target Create:

<target name="Create" >        
    <exec executable="cmd" >
        <arg value="/K" />        Note have also tried the
/C, /c, /k value  here but have the same result
        <arg value="Create.bat" />
    </exec>
</target>


Where Create.bat contains the following line:


SQLPlus "SYS/sys@DEMODB AS SYSDBA" @\newuser.sql


Everything is ok until the newuser.sql requires an input, at this point
SQLPlus exits without waiting for the prompt:

     [exec] Please input spool name. No file extension required (i.e.
DBC_SCR12345)   >> Disconnected from Oracle9i Ente
rprise Edition Release 9.2.0.6.0 - Production




If the Create.bat is run from the command line it waits for the input
and executes as expected.

 I've tried various combinations including running SQLPlus in place of
the cmd executable in ANT and had the same effect.
Any ideas?


Mike S.

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


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







      ____________________________________________________________________________________
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ