title: HSQL closed connection immediately when connecting from unit test
body: <p>I am trying to create an automated integration test against a running local JBoss 5.1 instance where I need to make assertions against the database. The appserver is configured with a HSQL datasource in server mode in order to be accessible through TCP. </p>
  
  <p>These are the relevant (I think) parts of the configuration:</p>
  
  <pre><code>&lt;connection-url&gt;jdbc:hsqldb:hsql://${jboss.bind.address}:1701&lt;/connection-url&gt;
  &lt;driver-class&gt;org.hsqldb.jdbcDriver&lt;/driver-class&gt;
  &lt;user-name&gt;sa&lt;/user-name&gt;
  &lt;password&gt;&lt;/password&gt;
  &lt;mbean code="org.jboss.jdbc.HypersonicDatabase" 
       name="jboss:service=Hypersonic"&gt;
       &lt;attribute name="Port"&gt;1701&lt;/attribute&gt;        
       &lt;attribute name="BindAddress"&gt;${jboss.bind.address}&lt;/attribute&gt;     
       &lt;attribute name="Silent"&gt;true&lt;/attribute&gt;
       &lt;attribute name="Database"&gt;default&lt;/attribute&gt;
       &lt;attribute name="Trace"&gt;false&lt;/attribute&gt;
       &lt;attribute name="No_system_exit"&gt;true&lt;/attribute&gt;
  &lt;/mbean&gt;
  </code></pre>
  
  <p>It works in that the deployed application runs fine and I am also able to connect to the database using external tools such as "hsqldbclient" and the Eclipse "Data Source Explorer".   </p>
  
  <p>The problem is that when I try to get a connection from my test case the connection is closed immediately and I get a "Broken Pipe" error.</p>
  
  <p>This is how I try to get a connection:</p>
  
  <pre><code>DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:1701", "sa", "");
  </code></pre>
  
  <p>This is the error I get on the client side:</p>
  
  <pre><code>Caused by: org.hsqldb.HsqlException: connection exception: connection failure: java.net.SocketException: Broken pipe
      at org.hsqldb.error.Error.error(Unknown Source)
      at org.hsqldb.ClientConnection.execute(Unknown Source)
      at org.hsqldb.ClientConnection.&lt;init&gt;(Unknown Source)
  </code></pre>
  
  <p>And this is the error I get on the server side:</p>
  
  <pre><code>09:46:04,132 ERROR [STDERR]    Exception in thread "HSQLDB Connection @fa3b82" 
  09:46:04,133 ERROR [STDERR]    java.lang.NullPointerException
  09:46:04,133 ERROR [STDERR]     at org.hsqldb.ServerConnection.close(Unknown Source)
  09:46:04,133 ERROR [STDERR]     at org.hsqldb.ServerConnection.run(Unknown Source)
  09:46:04,133 ERROR [STDERR]     at java.lang.Thread.run(Thread.java:662)
  </code></pre>
  
  <p>I am at a loss in trying to interpret what is happening. It looks like the connection is being made and then immediately closed by the server but the connection is then null which causes a nullpointer to be thrown. Note that this is all on the same machine and I am able to connect using other tools but with the same connection URL as described above.</p>
  
  <p>If anyone has any ideas of what to try I would be very grateful.</p>