General J2EE: jdbc commit or rollback

  1. jdbc commit or rollback (3 messages)

    hi, I have a method called servertoUpload(), this method to upload the data to server, this method called for each table to upload, here one user can call my method in number of times , my problem is here , after completion of calling the no.of times of my method then only it commit or roll back. ex. client call 4 times my method , after 2nd method database is suddenly down . then, total it has to be roll back.. after completion of 4 times only it commits. plz tell when i call commit or rollback.. regards deepika

    Threaded Messages (3)

  2. Re: jdbc commit or rollback[ Go to top ]

    I am not sure with this solution. But maybe you just try it. You create an Object variable (static variable) to put a Connection. On connection initialization, make sure to set it "NOT auto commit". This connection will rollbacked if the database is suddenly down. Every time your method is called, check wether is it the 4th execution or not (by using a counter). If it is the 4th calling, commit the connection. Also you have to be aware that a database connection has a timeout. Just pick a strategy so make this connection stay connected.
  3. Re: jdbc commit or rollback[ Go to top ]

    Hi deepika,... whether u have made the connection pool set for ur program...if it there means u can resolve this probelm easily.... regards, sathish
  4. jdbc commit or rollback in discussions[ Go to top ]

    HI satish, thanku for ur reply,its good for case of connection pooling , but, Iam using normal connection . Iam trying to use connection pooling. thanking you, deepika