Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

insert LocalDateTime argument to PostgreSQL-query parameter

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
     Greetings to all!
     Further the code with problem:


   I want to insert startDateTime and endDateTime .in ???-values in query.  

   Parameter datetime is has Timestamp-type.

   I tried to use that


  but without success...
 
Bartender
Posts: 3611
151
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I looked up how a datetime looks in PostGreSQL, and I tried

and it looks good.
 
Rancher
Posts: 4325
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How did you insert those two values into your SQL?
 
Andrey Dmitriev
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Dave Tolls wrote:How did you insert those two values into your SQL?



by using  org.springframework.jdbc.core.JdbcTemplate
 
Dave Tolls
Rancher
Posts: 4325
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since the above code in your first post doesn't work (that's invalid SQL for example) can you show us the code that you actually tried.

because you should simply be able to bind the Timestamps in in the same way the id is bound.


WHERE user_id=? AND datetime BETWEEN ? AND ? ORDER BY datetime
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!