dbunit/unitils: how to export a multi-schema dataset? -


the official tutorial of dbunit give example exporting dataset single database schema.
is there way export different tables different schemas 1 single dataset (say table_a schema_a, table_b schema_b)?
exported dataset, when written xml file, this:

<?xml version='1.0' encoding='utf-8'?> <dataset schema:schemaa schema:schemab>     <schemaa:tablea ..... />     <schemaa:tablea ..... />     <schemab:tableb ..... /> </dataset> 

i've got same problem , fix need set feature_qualified_table_names properties:

see below same example code change (i removed part of code because don't need full database export):

    public static void main(string[] args) throws exception     {         // database connection         class driverclass = class.forname("com.microsoft.sqlserver.jdbc.sqlserverdriver");         connection jdbcconnection = drivermanager.getconnection(                 "jdbc:sqlserver://<server>:1433;databasename=<dbname>", "<usr>", "<passwd>");         idatabaseconnection connection = new databaseconnection(jdbcconnection);          properties props = new properties();         props.put(databaseconfig.feature_qualified_table_names, "true");         connection.getconfig().setpropertiesbystring(props);                   // dependent tables database export: export table x , tables         // have pk fk on x, in right order insertion         string[] deptablenames = tablesdependencyhelper.getalldependenttables( connection, "vehicle.vehicle_series_model_sma" );         idataset depdataset = connection.createdataset( deptablenames );         flatxmldataset.write(depdataset, new fileoutputstream("vehicle.vehicle_series_model_sma.xml"));                } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -