title: Exporting an HSQLDB to XML using DBUnit results in null pointer errors
body: <p>I'm trying to export the entire contents of my database, an HSQLDB, to XML using DBUnit, and I'm getting null pointer errors that I can't understand.  I'm following the example in the <a href="http://www.dbunit.org/faq.html#extract" rel="nofollow">FAQ</a>:
  <pre><code>IDatabaseConnection xmlConnection = new DatabaseConnection(conn);
  IDataSet allTables = xmlConnection.createDataSet();
  XmlDataSet.write(allTables, new FileOutputStream(DATABASE_PATH + ".xml"));</pre></code></p>
  
  <p>The null pointer error occurs on the last line.  conn and DATABASE_PATH aren't null as they're both checked for that and used later in the program without a problem (exporting the database into CSV using OpenCSV, which works perfectly and exactly as expected).</p>
  
  <p>The stacktrace is as follows:
  <pre><code>org.dbunit.dataset.DataSetException: java.sql.SQLException: java.lang.NullPointerException java.lang.NullPointerException
      at org.dbunit.database.DatabaseDataSet.initialize(DatabaseDataSet.java:243)
      at org.dbunit.database.DatabaseDataSet.getTableNames(DatabaseDataSet.java:272)
      at org.dbunit.database.DatabaseDataSet.createIterator(DatabaseDataSet.java:258)
      at org.dbunit.dataset.AbstractDataSet.iterator(AbstractDataSet.java:189)
      at org.dbunit.dataset.stream.DataSetProducerAdapter.(DataSetProducerAdapter.java:63)
      at org.dbunit.dataset.xml.XmlDataSetWriter.write(XmlDataSetWriter.java:128)
      at org.dbunit.dataset.xml.XmlDataSet.write(XmlDataSet.java:104)
      at org.dbunit.dataset.xml.XmlDataSet.write(XmlDataSet.java:91)
      at pms.DatabaseExporter.exportToXML(DatabaseExporter.java:181)
      at pms.DatabaseExporter.main(DatabaseExporter.java:301)
  Caused by: java.sql.SQLException: java.lang.NullPointerException java.lang.NullPointerException
      at org.hsqldb.jdbc.Util.sqlException(Util.java:224)
      at org.hsqldb.jdbc.JDBCStatement.fetchResult(JDBCStatement.java:1830)
      at org.hsqldb.jdbc.JDBCStatement.executeQuery(JDBCStatement.java:181)
      at org.hsqldb.jdbc.JDBCDatabaseMetaData.execute(JDBCDatabaseMetaData.java:6150)
      at org.hsqldb.jdbc.JDBCDatabaseMetaData.getTables(JDBCDatabaseMetaData.java:3170)
      at org.dbunit.database.DefaultMetadataHandler.getTables(DefaultMetadataHandler.java:137)
      at org.dbunit.database.DatabaseDataSet.initialize(DatabaseDataSet.java:199)
      ... 9 more
  Caused by: org.hsqldb.HsqlException: java.lang.NullPointerException
      at org.hsqldb.error.Error.error(Error.java:108)
      at org.hsqldb.result.Result.newErrorResult(Result.java:1069)
      at org.hsqldb.StatementDMQL.execute(StatementDMQL.java:192)
      at org.hsqldb.Session.executeCompiledStatement(Session.java:1315)
      at org.hsqldb.Session.executeDirectStatement(Session.java:1206)
      at org.hsqldb.Session.execute(Session.java:990)
      at org.hsqldb.jdbc.JDBCStatement.fetchResult(JDBCStatement.java:1822)
      ... 14 more
  Caused by: java.lang.NullPointerException
      at org.hsqldb.types.CharacterType.compare(CharacterType.java:418)
      at org.hsqldb.index.IndexAVL.compareRowForInsertOrDelete(IndexAVL.java:617)
      at org.hsqldb.index.IndexAVLMemory.insert(IndexAVLMemory.java:214)
      at org.hsqldb.persist.RowStoreAVL.indexRow(RowStoreAVL.java:171)
      at org.hsqldb.persist.RowStoreAVLHybridExtended.indexRow(RowStoreAVLHybridExtended.java:99)
      at org.hsqldb.Table.insertSys(Table.java:2625)
      at org.hsqldb.dbinfo.DatabaseInformationMain.SYSTEM_TABLES(DatabaseInformationMain.java:2353)
      at org.hsqldb.dbinfo.DatabaseInformationMain.generateTable(DatabaseInformationMain.java:348)
      at org.hsqldb.dbinfo.DatabaseInformationFull.generateTable(DatabaseInformationFull.java:379)
      at org.hsqldb.dbinfo.DatabaseInformationMain.setStore(DatabaseInformationMain.java:507)
      at org.hsqldb.persist.PersistentStoreCollectionSession.getStore(PersistentStoreCollectionSession.java:138)
      at org.hsqldb.Table.getRowStore(Table.java:2817)
      at org.hsqldb.RangeVariable$RangeIteratorMain.(RangeVariable.java:939)
      at org.hsqldb.RangeVariable$RangeIteratorMain.(RangeVariable.java:917)
      at org.hsqldb.RangeVariable.getIterator(RangeVariable.java:770)
      at org.hsqldb.QuerySpecification.buildResult(QuerySpecification.java:1293)
      at org.hsqldb.QuerySpecification.getSingleResult(QuerySpecification.java:1245)
      at org.hsqldb.QuerySpecification.getResult(QuerySpecification.java:1235)
      at org.hsqldb.StatementQuery.getResult(StatementQuery.java:66)
      at org.hsqldb.StatementDMQL.execute(StatementDMQL.java:190)
      ... 18 more</pre></code></p>
  
  <p>I've googled and couldn't find anything relating to this kind of error during export. I'm not that experienced with SQL or JDBC so I'm hoping there's enough info in the stack trace for someone more knowledgeable to tell me what's going wrong.  If there's some other library that would be better for my needs, I have no problem switching... The only thing I need is export/import with XML right now, so I'm not using DBUnit for anything else.  Anyway if anybody can tell me what's going on wrong or if I ought to be using something else I'd really appreciate it.</p>