• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting timestamp from the DB

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That sounds like a good idea. Thanks for the help!
 
reply
    Bookmark Topic Watch Topic
  • New Topic