title: DBUnit and SQL Server getting a socket closed
body: <p>I keep getting this exception with DBUnit in the same place:</p>
  
  <pre><code>org.dbunit.dataset.DataSetException: com.microsoft.sqlserver.jdbc.SQLServerException: Socket closed
  at   org.dbunit.database.DatabaseTableMetaData.getColumns(DatabaseTableMetaData.java:359)
  </code></pre>
  
  <p>etc.</p>
  
  <pre><code>Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Socket closed
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(Unknown Source)
  at com.microsoft.sqlserver.jdbc.TDSChannel.read(Unknown Source)
  at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(Unknown Source)
  at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(Unknown Source)
  at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
  at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQueryInternal(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getResultSetFromStoredProc(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getResultSetWithProvidedColumnNames(Unknown Source)
  at com.microsoft.sqlserver.jdbc.SQLServerDatabaseMetaData.getColumns(Unknown Source)
  at org.dbunit.database.DefaultMetadataHandler.getColumns(DefaultMetadataHandler.java:52)
  at org.dbunit.database.DatabaseTableMetaData.getColumns(DatabaseTableMetaData.java:315)
  ... 15 more
  </code></pre>
  
  <p>This happens when trying to read the column metadata from the table. The code doing this looks like this:</p>
  
  <pre><code> new DefaultTable(tableName,
                      Columns.getColumns(columns,
                              connection.createDataSet(new String[]{tableName})
                                      .getTableMetaData(tableName).getColumns()
                      )
              )
  </code></pre>
  
  <p>connection being an MsSqlConnection instance. At first I thought it was a network problem, but there are two problems with that theory. First the server running the test and the database are both virtual machines on the same xen server, so there is no real network. Second, although the problem is inconsistent, it happens in the same place every time. There are over 100 database tests, but this same one is the one that fails (when it fails).</p>
  
  <p>Has anyone run across a similar problem? Any insights?</p>