is it possible in ANT to check whether or not a database (connection) exists without a build failure?
For instance:
<target name="check-database-available">
<sql
classpath="${oracle.jar}" driver="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@${my.db.host}:${my.db.port}:${my.db.sid}"
userid="${my.db.user}"
password="${my.db.pw}"
onerror="continue" errorproperty="exit.status">
select * from dual;
</sql>
<echo message="### exit status = ${exit.status}" />
</target>
This will always happen with a BUILD FAILED error and
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
because db does not exist yet. Setting "onerror" to "continue" and checking for "errorproperty" will not work, as the task does not seem to be running.
Peter source
share