I am trying to develop an ANT script that calls SQL*Plus and executes a SQL file. Using the following:
<exec executable="sqlplus" failonerror="true">
<arg value="-LOGON"/>
<arg value="scott/${db.pwdapps}"/>
<arg value="@${scm.target}/install/sql/XXCUST_COMMON_PKG.pks"/>
</exec>
This works but when the username or password is incorrectly supplied, SQL*Plus returns with status of success and hence ANT returns the same.
Anyone know how to make SQLPlus return an error status when the username or password is incorrect?
sqlplus /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 14 08:48:07 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
SQL> whenever sqlerror exit failure
SQL> connect ronr/wrongpwd
ERROR:
ORA-01017: invalid username/password; logon denied
echo $?
1
Convert the script to use a here document, or have the script to do the connect after setting the sqlerror and pass the connect info as arguments for the script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With