File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and Relational Databases and the fly likes doubts in setDate(i,date,cal) API of preparedStatement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "doubts in setDate(i,date,cal) API of preparedStatement" Watch "doubts in setDate(i,date,cal) API of preparedStatement" New topic
Author

doubts in setDate(i,date,cal) API of preparedStatement

Vinney Shanmugam
Ranch Hand

Joined: Aug 27, 2008
Posts: 104


This is code should insert date = 1999-05-05 to the table in the database or the current date, when the this program is executed?
I am not clear about how the code for setDate(1,date,cal) is implemented. How significantly, the calendar object helps in setting date?
ujjwal soni
Ranch Hand

Joined: Mar 28, 2007
Posts: 403
What error are you getting ?

Check out my code below



Cheers!!!
Ujjwal B Soni <baroda, gujarat, india> <+919909981973>
"Helping hands are better than praying lips......"
Vinney Shanmugam
Ranch Hand

Joined: Aug 27, 2008
Posts: 104
Hi ujjwal.... thanks for the reply. But, my doubt is on setDate(1,date,calendar) and your program is about setDate(1,date), which i am not interested in.

If you could please explain me about setDate(1,date,cal) API.... thanks a lot for the reply though.....!
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31577
    
185

explorer vinney wrote:How significantly, the calendar object helps in setting date?

It's for the time zone. In your example, it's not much use for two reasons:
1) There isn't a time
2) The date and calendar refer to the same object


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://kickstarter.com/rocket-mass-heater
 
subject: doubts in setDate(i,date,cal) API of preparedStatement