Getting problem while inserting or updating the data

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting problem while inserting or updating the data

Surti Pratik

Hi All,

 

I am trying following approach and getting problem while inserting or updating the data.

 

I have a table named product_brand and having single column brand_code which is primary key of the table. Now in dataset I have following data:

 

<?xml version='1.0' encoding='UTF-8'?>

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

</dataset>

 

Now I am adding following row in in dataset file:

 

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

  <product_brad brand_code="b3"/>

</dataset>

 

According to me, It should update the row in database table but the row is not getting updated. I tried following data set operation one by one but it is not updating a single row in my db.

 

                DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);

                DatabaseOperation.UPDATE.execute(connection, dataSet);

                DatabaseOperation.REFRESH.execute(connection, dataSet);

                DatabaseOperation.INSERT.execute(connection, dataSet);

 

If there are more than one table which may have dependency on each other then the columns and row are getting updated.

 

Is there anything that I should add which might be missing as I am simply appending a row only?

 

Thanks and Regards,

Pratik SURTI

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting problem while inserting or updating the data

John Hurst-2
Can you provide more detail about how you are trying to load this dataset? Maybe show your code in setting up and executing your DatabaseOperation. Did you find that running your DbUnit code affected *anything* in your database?

You should be able to load all rows with CLEAN_INSERT.

Regards

John Hurst
Wellington, New Zealand

On Thu, Mar 25, 2010 at 9:47 PM, Surti, Pratik <[hidden email]> wrote:

Hi All,

 

I am trying following approach and getting problem while inserting or updating the data.

 

I have a table named product_brand and having single column brand_code which is primary key of the table. Now in dataset I have following data:

 

<?xml version='1.0' encoding='UTF-8'?>

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

</dataset>

 

Now I am adding following row in in dataset file:

 

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

  <product_brad brand_code="b3"/>

</dataset>

 

According to me, It should update the row in database table but the row is not getting updated. I tried following data set operation one by one but it is not updating a single row in my db.

 

                DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);

                DatabaseOperation.UPDATE.execute(connection, dataSet);

                DatabaseOperation.REFRESH.execute(connection, dataSet);

                DatabaseOperation.INSERT.execute(connection, dataSet);

 

If there are more than one table which may have dependency on each other then the columns and row are getting updated.

 

Is there anything that I should add which might be missing as I am simply appending a row only?

 

Thanks and Regards,

Pratik SURTI

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user




--
Life is interfering with my game

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting problem while inserting or updating thedata

Surti Pratik

Below is the code:

 

File: DBUnitUtils.java

 

private IDatabaseConnection connection;

 

public DBUnitUtils() throws Exception {

            //initialize your database connection here

            IDatabaseTester iDatabaseTester = new JdbcDatabaseTester(

                        "com.mysql.jdbc.Driver",

                        "jdbc:mysql://localhost:3306/mydb?useUnicode=true&amp;cacheResultSetMetadata=true",

                        "usrnm", "pwd");

            connection = iDatabaseTester.getConnection();

      }

.

.

.  some other code…

.

 

public void setUpDataBase(String fileName) throws Exception {

            // initialize your dataset here

            IDataSet dataSet = getDataSet(fileName);

            connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory() );

            DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);

}

 

 

File: ProductBrandTestCase.java

 

@BeforeClass

    public static void oneTimeSetUp() throws Exception

    {

        Bundle.start();

 

        productBrandTypeQueries = ProductPackage.getAcceptedBrandTypeQueries();

        DBUnitUtils dBUnitUtils = new DBUnitUtils();

        dBUnitUtils.setUpDataBase ("/productBrandTestCase.xml");

    }

 

Thanks and Regards,

Pratik SURTI

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 

From: John Hurst [mailto:[hidden email]]
Sent: Thursday, March 25, 2010 4:38 PM
To: [hidden email]
Subject: Re: [dbunit-user] Getting problem while inserting or updating thedata

 

Can you provide more detail about how you are trying to load this dataset? Maybe show your code in setting up and executing your DatabaseOperation. Did you find that running your DbUnit code affected *anything* in your database?

You should be able to load all rows with CLEAN_INSERT.

Regards

John Hurst
Wellington, New Zealand

On Thu, Mar 25, 2010 at 9:47 PM, Surti, Pratik <[hidden email]> wrote:

Hi All,

 

I am trying following approach and getting problem while inserting or updating the data.

 

I have a table named product_brand and having single column brand_code which is primary key of the table. Now in dataset I have following data:

 

<?xml version='1.0' encoding='UTF-8'?>

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

</dataset>

 

Now I am adding following row in in dataset file:

 

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

  <product_brad brand_code="b3"/>

</dataset>

 

According to me, It should update the row in database table but the row is not getting updated. I tried following data set operation one by one but it is not updating a single row in my db.

 

                DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);

                DatabaseOperation.UPDATE.execute(connection, dataSet);

                DatabaseOperation.REFRESH.execute(connection, dataSet);

                DatabaseOperation.INSERT.execute(connection, dataSet);

 

If there are more than one table which may have dependency on each other then the columns and row are getting updated.

 

Is there anything that I should add which might be missing as I am simply appending a row only?

 

Thanks and Regards,

Pratik SURTI

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user




--
Life is interfering with my game


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting problem while inserting or updating the data

Karl Jóhann Pálsson
In reply to this post by Surti Pratik

Just to rule out the obvious, does your xml have product_brad or product_braNd ?

 

If you don't have a matching table....

 

From: Surti, Pratik [mailto:[hidden email]]
Sent: Thursday, March 25, 2010 8:47 AM
To: [hidden email]
Subject: [dbunit-user] Getting problem while inserting or updating the data

 

Hi All,

 

I am trying following approach and getting problem while inserting or updating the data.

 

I have a table named product_brand and having single column brand_code which is primary key of the table. Now in dataset I have following data:

 

<?xml version='1.0' encoding='UTF-8'?>

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

</dataset>

 

Now I am adding following row in in dataset file:

 

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

  <product_brad brand_code="b3"/>

</dataset>

 

According to me, It should update the row in database table but the row is not getting updated. I tried following data set operation one by one but it is not updating a single row in my db.

 

                DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);

                DatabaseOperation.UPDATE.execute(connection, dataSet);

                DatabaseOperation.REFRESH.execute(connection, dataSet);

                DatabaseOperation.INSERT.execute(connection, dataSet);

 

If there are more than one table which may have dependency on each other then the columns and row are getting updated.

 

Is there anything that I should add which might be missing as I am simply appending a row only?

 

Thanks and Regards,

Pratik SURTI

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting problem while inserting or updating thedata

Surti Pratik

It is just an example I have created. Here its typo error. Consider it as product_brand only. For e.g. <product_brand brand_code="b1"/>. In my application table names are different and no error in naming conventions.

 

 

Thanks and Regards,

Pratik SURTI

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 

From: Karl Jóhann Pálsson [mailto:[hidden email]]
Sent: Thursday, March 25, 2010 6:18 PM
To: [hidden email]
Subject: Re: [dbunit-user] Getting problem while inserting or updating thedata

 

Just to rule out the obvious, does your xml have product_brad or product_braNd ?

 

If you don't have a matching table....

 

From: Surti, Pratik [mailto:[hidden email]]
Sent: Thursday, March 25, 2010 8:47 AM
To: [hidden email]
Subject: [dbunit-user] Getting problem while inserting or updating the data

 

Hi All,

 

I am trying following approach and getting problem while inserting or updating the data.

 

I have a table named product_brand and having single column brand_code which is primary key of the table. Now in dataset I have following data:

 

<?xml version='1.0' encoding='UTF-8'?>

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

</dataset>

 

Now I am adding following row in in dataset file:

 

<dataset>

  <product_brad brand_code="b1"/>

  <product_brad brand_code="b2"/>

  <product_brad brand_code="b3"/>

</dataset>

 

According to me, It should update the row in database table but the row is not getting updated. I tried following data set operation one by one but it is not updating a single row in my db.

 

                DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);

                DatabaseOperation.UPDATE.execute(connection, dataSet);

                DatabaseOperation.REFRESH.execute(connection, dataSet);

                DatabaseOperation.INSERT.execute(connection, dataSet);

 

If there are more than one table which may have dependency on each other then the columns and row are getting updated.

 

Is there anything that I should add which might be missing as I am simply appending a row only?

 

Thanks and Regards,

Pratik SURTI

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user
Reply | Threaded
Open this post in threaded view
|

Re: Getting problem while inserting or updating thedata

Matthias Gommeringer

Please provide a testcase that lets us reproduce this issue. Do you create 2 different datasets based on 2 different dataset files?

rgds,

matthias


Von: "Surti, Pratik" <[hidden email]>
Gesendet: 25.03.2010 13:53:47
An: [hidden email]
Betreff: Re: [dbunit-user] Getting problem while inserting or updating thedata

It is just an example I have created. Here its typo error. Consider it as product_brand only. For e.g. <product_brand brand_code="b1"/>. In my application table names are different and no error in naming conventions.

 

 

 

 

Thanks and Regards,

 

Pratik SURTI

 

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 

 

From: Karl Jóhann Pálsson [mailto:[hidden email]]
Sent: Thursday, March 25, 2010 6:18 PM
To: [hidden email]
Subject: Re: [dbunit-user] Getting problem while inserting or updating thedata

 

 

 

 

Just to rule out the obvious, does your xml have product_brad or product_braNd ?

 

 

If you don't have a matching table....

 

 

From: Surti, Pratik [mailto:[hidden email]]
Sent: Thursday, March 25, 2010 8:47 AM
To: [hidden email]
Subject: [dbunit-user] Getting problem while inserting or updating the data

 

 

Hi All,

 

 

 

 

 

I am trying following approach and getting problem while inserting or updating the data.

 

 

 

 

 

I have a table named product_brand and having single column brand_code which is primary key of the table. Now in dataset I have following data:

 

 

 

 

 

<?xml version='1.0' encoding='UTF-8'?>

 

 

<dataset>

 

 

  <product_brad brand_code="b1"/>

 

 

  <product_brad brand_code="b2"/>

 

 

</dataset>

 

 

 

 

 

Now I am adding following row in in dataset file:

 

 

 

 

 

<dataset>

 

 

  <product_brad brand_code="b1"/>

 

 

  <product_brad brand_code="b2"/>

 

 

  <product_brad brand_code="b3"/>

 

 

</dataset>

 

 

 

 

 

According to me, It should update the row in database table but the row is not getting updated. I tried following data set operation one by one but it is not updating a single row in my db.

 

 

 

 

 

                DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);

 

 

                DatabaseOperation.UPDATE.execute(connection, dataSet);

 

 

                DatabaseOperation.REFRESH.execute(connection, dataSet);

 

 

                DatabaseOperation.INSERT.execute(connection, dataSet);

 

 

 

 

 

If there are more than one table which may have dependency on each other then the columns and row are getting updated.

 

 

 

 

 

Is there anything that I should add which might be missing as I am simply appending a row only?

 

 

 

 

 

Thanks and Regards,

 

Pratik SURTI

 

Atos Origin India | [hidden email]| D: +91 22 67333644 | M: +91 9769482298

 

 

 

 


------------------------------------------------------------------------------ Download Intel&#174; Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ dbunit-user mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/dbunit-user  

GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!   
Jetzt freischalten unter http://movieflat.web.de

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
dbunit-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/dbunit-user