• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

preparedStatement.setDate and java.util.Date

 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried to setDate for preparedStatement and piyt in it java.util.Date object but it is falied at compile time,if make cast to it at runtime exception cast exception.
how to send java.util.Date to DB please
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As can be seen from the javadoc api, PreparedStatement.setDate() is accepting java.sql.Date object..not java.util.Date.
 
hani Ibrahim
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i know that because of that i asked how to send Date from java to Database?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15480
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Convert your java.util.Date object to a java.sql.Date object:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic