Guest_imported
New member
- Jan 1, 1970
- 0
In my Java app, I created a simple pool of Connection objects to my PostgreSQL database, and I grab them when needed. But I'm having a problem with dates. When I start the server (Jetty) and insert some records with date fields set to CURRENT_DATE (timestamps set to CURRENT_TIMESTAMP), everything is fine. But if I leave the app running and come back to it the next day, it will insert incorrect dates and timestamps (they will be many hours behind the actual date/time). But if I psql into Postgres and select CURRENT_DATE or CURRENT_TIMESTAMP, the current date or timestamp is displayed. If I shut down and restart the server, the correct date/timestamp will be displayed. It only gets out of whack when I hold the Connection objects for long periods of time, and apparently only dates inserted on those old Connections (and not through psql) will be incorrect. Does anyone have a clue as to what is going on here? Am I wrong to be holding these Connection objects the way I am? This is the only problem I've noticed so far with this approach.