This is your connection URL in Ant:
<property name="db.connection.url" value="jdbc:hsqldb:mem:adb"/>
You must use the same URL and the same username and password for a connection:
connection = DriverManager.getConnection("jdbc:hsqldb:mem:adb", "a", "a");
Update: When using a memory database, the Ant target and the JUnit tests must run in the same JVM. If you are running the two in separate JVM's, start an HSQLDB server before the tests and connect to this server from each test. The server connection URL's are different and described in the HSQLDB Guide.