Hi,
is there a possibility in ANT to check whether a database (connection) exists or not without failing the build?
For example:
<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 fail with BUILD FAILED and
java.sql.SQLException: ORA-01017: invalid username/password; logon denied
because the db does not exist yet. Setting "onerror" to "continue" and checking the "errorproperty" won't work as the task seems not to be executed.
Thanks,
Peter