This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
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 Introducing JavaFX 8 Programming this week in the JavaFX 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> <+918866008962>
"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: 32609
    
215

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]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, 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
 
jQuery in Action, 3rd edition