Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Eclipse Collections Categorically: Level up your programming game
this week in the
Open Source Projects
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
JDBC and Relational Databases
preparedStatement.setDate and java.util.Date
hani Ibrahim
Ranch Hand
Posts: 182
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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: 218
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i know that because of that i asked how to send Date from
java
to Database?
Jesper de Jong
Java Cowboy
Posts: 16084
88
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Convert your java.util.Date object to a java.sql.Date object:
java.util.Date date = ...; // wherever you get this from java.sql.Date sqlDate = new java.sql.Date(date.getTime());
Jesper's Blog
-
Pluralsight Author Page
It was the best of times. It was the worst of times. It was a tiny ad.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Enterprise application: handling date and time
Save date to the database
populating the databse
Date function
Using CacheRowset
More...