DBUnit - NoSuchTableException on existing table '6RESTEntite'

View: New views
2 Messages — Rating Filter:   Alert me  

DBUnit - NoSuchTableException on existing table '6RESTEntite'

by Keeeeg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

My apologies for my english.

I have a table named '6RESTEntite' on SQL Server 2000 and DBUnit do not find it. I try to export some data with the following code :

        public static void main(String[] args) throws Exception
    {
        // database connection
        Class driverClass = Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
        Connection jdbcConnection = DriverManager.getConnection(
                "jdbc:microsoft:sqlserver://SADW4010\\W4RTU;DatabaseName=6RES;", "myUser", "myPass");
        IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

        // partial database export
        QueryDataSet partialDataSet = new QueryDataSet(connection);
        partialDataSet.addTable("[6RESTEntite]");
        FlatXmlDataSet.write(partialDataSet, new FileOutputStream("partial.xml"));
    }

I get the follozing error :

Exception in thread "main" org.dbunit.dataset.NoSuchTableException: [6RESTEntite]
        at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:222)
        at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:257)
        at org.dbunit.database.QueryTableIterator.getTable(QueryTableIterator.java:143)
        at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:83)
        at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:97)
        at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:290)
        at com.caexa.b1stc.bd.OutilsXMLDataSet.main(OutilsXMLDataSet.java:302)


with : partialDataSet.addTable("\"6RESTEntite\"") , I have the same error
and with : partialDataSet.addTable("6RESTEntite") , I get the follwing error :

org.dbunit.dataset.DataSetException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Ligne 1 : syntaxe incorrecte vers '6'.
        at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:266)
        at org.dbunit.database.QueryTableIterator.getTable(QueryTableIterator.java:143)
        at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:83)
        at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:97)
        at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:290)
        at com.caexa.b1stc.bd.OutilsXMLDataSet.main(OutilsXMLDataSet.java:302)


I use Hibernate to map this table and I reference it with '[6RESTEntite]'. It works fine.

How should I reference this table to get DBUnit work?

Thanks for help.

Re: DBUnit - NoSuchTableException on existing table '6RESTEntite'

by jcarmonaloeches :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ideas:
  -To connect to the correct scheme of the BBDD.
  -To put the scheme of DDBB befoer the table Name.
  -Check if the name is correct.
  -The name of the table sounds not good...

Jaime

Keeeeg wrote:
Hi,

My apologies for my english.

I have a table named '6RESTEntite' on SQL Server 2000 and DBUnit do not find it. I try to export some data with the following code :

        public static void main(String[] args) throws Exception
    {
        // database connection
        Class driverClass = Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
        Connection jdbcConnection = DriverManager.getConnection(
                "jdbc:microsoft:sqlserver://SADW4010\\W4RTU;DatabaseName=6RES;", "myUser", "myPass");
        IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);

        // partial database export
        QueryDataSet partialDataSet = new QueryDataSet(connection);
        partialDataSet.addTable("[6RESTEntite]");
        FlatXmlDataSet.write(partialDataSet, new FileOutputStream("partial.xml"));
    }

I get the follozing error :

Exception in thread "main" org.dbunit.dataset.NoSuchTableException: [6RESTEntite]
        at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:222)
        at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:257)
        at org.dbunit.database.QueryTableIterator.getTable(QueryTableIterator.java:143)
        at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:83)
        at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:97)
        at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:290)
        at com.caexa.b1stc.bd.OutilsXMLDataSet.main(OutilsXMLDataSet.java:302)


with : partialDataSet.addTable("\"6RESTEntite\"") , I have the same error
and with : partialDataSet.addTable("6RESTEntite") , I get the follwing error :

org.dbunit.dataset.DataSetException: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Ligne 1 : syntaxe incorrecte vers '6'.
        at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:266)
        at org.dbunit.database.QueryTableIterator.getTable(QueryTableIterator.java:143)
        at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:83)
        at org.dbunit.dataset.xml.FlatXmlWriter.write(FlatXmlWriter.java:97)
        at org.dbunit.dataset.xml.FlatXmlDataSet.write(FlatXmlDataSet.java:290)
        at com.caexa.b1stc.bd.OutilsXMLDataSet.main(OutilsXMLDataSet.java:302)


I use Hibernate to map this table and I reference it with '[6RESTEntite]'. It works fine.

How should I reference this table to get DBUnit work?

Thanks for help.
LightInTheBox - Buy quality products at wholesale price!