Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

commit - database operation  RSS feed

 
veena sasikumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have more than one( it can go up to 10) insert statements for entering data in to a table which I am doing with PreparedStatement. In all the insert statements one of the parameters is time and I use sysdate as the value of this field. Till now, whenever I commit at the end of all transaction through java, I am getting the same time entered in to the database. Will it be same in all cases.

Thanks and regards

veena
 
Sidd Kulk
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably the sysdate is getting entered fast enough before the time changes and all insert statements might virtually be getting entered into database simultaneously. But is this really your problem??

Njoy,
Sid
 
veena sasikumar
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for the reply. My problem is not this. I want to write a query based on the time.But if the postings are done at different timings, my query will fail. Can I rely on the matter that, all the statements will be posted to the database at the same time?

thanks and regards

veena
 
Campbell Ritchie
Marshal
Posts: 55681
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a query for the Databases forum . . .

Have you set up each insertion operation as a transaction? Does the single "commit" make the operations all together behave as if they were a single transaction? This may vary from database to database; please check the manufacturer's specifications. If you make the whole lot behave as a single transaction you might get the same time for everything.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!