wood burning stoves 2.0*
The moose likes JDBC 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
JavaRanch » Java Forums » Databases » JDBC
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30293
    
150

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


[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://aspose.com/file-tools
 
subject: doubts in setDate(i,date,cal) API of preparedStatement