[long][dbunit/mysql] org.dbunit.dataset.NoSuchColumnException

From: Gluon (No.Spam_at_cnil.fr)
Date: 01/13/05

  • Next message: Wordster: "Hibernate: "index" for "map" not working for me"
    Date: Thu, 13 Jan 2005 18:18:23 +0100
    
    

    Heya there,
    I'm trying to setup some database related tests using dbunit and get
    this error.

    Regarding the console msg i first thoughts this was a dbunit
    DatabaseFactory issue. I used the MySqlDataTypeFactory with no success.

    org.dbunit.dataset.NoSuchColumnException: weibulldataset.id
            at
    org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:71)
            at
    org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:129)
            at
    org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:67)
            at org.dbunit.DatabaseTestCase.executeOperation(DatabaseTestCase.java:87)
            at org.dbunit.DatabaseTestCase.setUp(DatabaseTestCase.java:104)
            at junit.framework.TestCase.runBare(TestCase.java:125)
            at junit.framework.TestResult$1.protect(TestResult.java:106)
            at junit.framework.TestResult.runProtected(TestResult.java:124)
            at junit.framework.TestResult.run(TestResult.java:109)
            at junit.framework.TestCase.run(TestCase.java:118)
            at junit.framework.TestSuite.runTest(TestSuite.java:208)
            at junit.framework.TestSuite.run(TestSuite.java:203)
            at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
            at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
            at
    org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)

    Any help really appreciate:!

    Console:
    WARNING - weibulldataset.id data type (1111, ‘int unsigned’) not
    recognized and will be ignored. See FAQ for more information.
    WARNING - weibulldataset.alpha data type (1111, ‘double unsigned
    zerofill unsigned’) not recognized and will be ignored. See FAQ for more
    information.
    WARNING - weibulldataset.beta data type (1111, ‘double unsigned zerofill
    unsigned’) not recognized and will be ignored. See FAQ for more information.
    WARNING - weibulldataset.gamma data type (1111, ‘double unsigned
    zerofill unsigned’) not recognized and will be ignored. See FAQ for more
    information.

    config:
    Win 2000 pro
    junit 3.8.1
    dbunit 2.1
    mysql 4.0.20a-net-max
    jvm 1.4.2

    database schema:
    #
    # weibulldataset
    #
    CREATE TABLE `weibulldataset` (
       `id` int(7) unsigned NOT NULL auto_increment,
       `name` varchar(128) NOT NULL default '',
       `alpha` double unsigned zerofill NOT NULL default
    '0000000000000000000000',
       `beta` double unsigned zerofill NOT NULL default
    '0000000000000000000000',
       `gamma` double unsigned zerofill NOT NULL default
    '0000000000000000000000',
       PRIMARY KEY (`id`,`name`)
    ) TYPE=InnoDB COMMENT='Weibull data set storage space';

    testcase code:
    public class WeibullSampleTest extends DatabaseTestCase {
            
            private WeiBullDataSetService s = WeiBullDataSetService.getInstance();
            
            public WeibullSampleTest(String name){
                    super(name);
            }
            
            /* (non-Javadoc)
             * @see org.dbunit.DatabaseTestCase#getConnection()
             */
            protected IDatabaseConnection getConnection() throws Exception {
                    
                    Class driverClass =
    Class.forName(Messages.getString("hibernate.connection.driver_class"));
    //$NON-NLS-1$
                Connection jdbcConnection =
    DriverManager.getConnection(Messages.getString("hibernate.connection.url"),
    Messages.getString("hibernate.connection.username"),
    Messages.getString("hibernate.connection.password")); //$NON-NLS-1$
    //$NON-NLS-2$ //$NON-NLS-3$
                        
                IDatabaseConnection conn= new DatabaseConnection(jdbcConnection);
                DatabaseConfig config = conn.getConfig();
            
                config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new
    MySqlDataTypeFactory()); // here i specify MySql
                config.setFeature(DatabaseConfig.FEATURE_BATCHED_STATEMENTS, false);
            
                return conn;
            }
            
            /* (non-Javadoc)
             * @see org.dbunit.DatabaseTestCase#getDataSet()
             */
            protected IDataSet getDataSet() throws Exception {
                    return new FlatXmlDataSet(new
    FileInputStream(DbUnitMessages.getString("dbunit.weibull.dataset.ref")));
    //$NON-NLS-1$
            }

    the file used here
    FileInputStream(DbUnitMessages.getString("dbunit.weibull.dataset.ref")));
      is :
    <?xml version='1.0' encoding='UTF-8'?>
    <dataset>
       <weibulldataset id="1" name="test1" alpha="10.0" beta="12.0"
    gamma="14.0"/>
       <weibulldataset id="2" name="test2" alpha="20.0" beta="22.0"
    gamma="24.0"/>
       <weibulldataset id="3" name="test3" alpha="30.0" beta="32.0"
    gamma="34.0"/>
    </dataset>


  • Next message: Wordster: "Hibernate: "index" for "map" not working for me"

    Relevant Pages

    • Re: Database set up help
      ... let's see...I choose the y/n data type because I am using ... User opens up form and enters Employee Information in the fields ... 2 of the 38 options in my main menu are BPCS Applications ... I set up a database with this so far: ...
      (microsoft.public.access.gettingstarted)
    • Re: runtime error with Mask edit control
      ... DateOfBirth property is a string. ... If no value is entered into the Property, the database stores a null. ... > its data type (one would assume the same as the property, ...
      (microsoft.public.vb.controls)
    • Re: Type Mismatch Error Message
      ... >> Using Text as SQL data type. ... I created a database on a SQL server manually and matched the column names ... I thought you "didn't use the database wizard?" ... >> Data type in form is No Constraints. ...
      (microsoft.public.frontpage.programming)
    • RE: function doesnt return value - SOMETIMES!
      ... It seems the calling stack has some issues. ... If not, I suggest that you create a new database, and import the ... |> thing I can see is that you are declaring 3 of your numerical values as ... |> when it does work correctly that would be because this data type is ...
      (microsoft.public.access.modulesdaovba)
    • Re: Using query values for field name in table
      ... When creating the new field, use a Boolean data type, not a Text data type. ... Gunny ... See http://www.QBuilt.com for all your database needs. ... I had to change slightly the syntax referring to the ...
      (microsoft.public.access.modulesdaovba)