Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / January 2005

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Gluon - 13 Jan 2005 17:18 GMT
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
Gluon - 14 Jan 2005 09:15 GMT
Heya there, i finaly found that the unsigned are not supported by
dbUnit, her eis the new schema and everythings works like a charms

#
# weibulldataset
#
CREATE TABLE `weibulldataset` (
  `id` bigint(20) NOT NULL auto_increment,
  `name` varchar(128) NOT NULL default '',
  `alpha` double NOT NULL default '0',
  `beta` double NOT NULL default '0',
  `gamma` double NOT NULL default '0',
  PRIMARY KEY  (`id`,`name`)
) TYPE=InnoDB COMMENT='Weibull data Knowledge Base';

cheers

> Heya there,
> I'm trying to setup some database related tests using dbunit and get
[quoted text clipped - 124 lines]
> gamma="34.0"/>
> </dataset


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.