Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

insert LocalDateTime argument to PostgreSQL-query parameter

 
Ranch Hand
Posts: 122
  • 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: 3954
154
  • 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: 4576
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: 122
  • 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: 4576
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
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic