Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Getting timestamp from the DB

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I have an app, that requires me to do a batch update. The batch update works great. I've run into one problem, however. In my stored procedure, I am setting a variable with the current timestamp. My problem is, this timestamp changes with each time a batch statement runs. Say I have 20 statements I am sending to my procedure, I want one timestamp value to be the same on all these rows when they are inserted into the database.
Can't use the PC time - need the Database time.
Is there any way within the java app to get the date from the database, maybe through meta data, or something else?

Please let me know if you have any suggestions.
Thanks!
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34178
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jennifer,
You could do one query to get the system time on the database. Then pass that as a parameter for each batched statement.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That sounds like a good idea. Thanks for the help!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic