Bug 50484 - Multiple calls to Ant script <sql> task fail with ojdbc5.jar
Summary: Multiple calls to Ant script <sql> task fail with ojdbc5.jar
Status: NEW
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.7.1
Hardware: Other Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Ant Notifications List
Depends on:
Reported: 2010-12-16 07:34 UTC by Keith Davidson
Modified: 2011-08-18 13:19 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Keith Davidson 2010-12-16 07:34:53 UTC
We are using an Ant script to apply SQL scripts to a database.  This is done using the core <sql> task within a macro passing the script as a parameter, ie

<sql driver="oracle.jdbc.driver.OracleDriver" url="@{url}" userid="@{user}" password="@{password}" classpathref="database.drivers" >
                                <transaction src="@{script}" />

A controlling shell script calls several Ant targets (each with a new instance of Ant).  We have reproduced the problem just calling Ant several times from the shell.

The first call works fine but subsequent calls report

.../build.xml:106: The following error occurred while executing this line:
.../build.xml:29: java.sql.SQLException: IO Error: Connection reset

After some delay (several minutes) running the same script works fine.

This does not seem related to the content of the SQL script - even simple select statements show this problem.

We have recently updated to use the newer Oracle ojdbc5.jar reverting back to the ojdbc14.jar fixes the problem.

We are using Ant 1.7.1 (but have reproduced the problem with 1.8.1)

Running on an Ubuntu server:
2.6.24-28-generic #1 SMP Wed Nov 24 09:30:14 UTC 2010 i686 GNU/Linux

Java version:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)

The Oracle ojdbc5.jar reports its version as:
Oracle JDBC 3.0 compiled with JDK5 on Sat_Aug_14_12:16:40_PDT_2010

The Oracle ojdbc14.jar fails to report its version - ie there is no manifest in that jar file.
Comment 1 Oleg 2011-08-18 13:19:58 UTC
We experienced the same problem when upgrading oracle drivers from 10.x to

Issue could be resolved by adding -Djava.security.egd=file:///dev/urandom to jvm system properties by doing
export ANT_OPTS="-Djava.security.egd=file:///dev/urandom"
prior to running ant.

It is not specific to ant, but to jdbc driver which is now using /dev/random which doesn't have enough entropy on servers.
More info could be found in: