This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Insert Date With Time Prepared Stament...? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Insert Date With Time Prepared Stament...?" Watch "Insert Date With Time Prepared Stament...?" New topic

Insert Date With Time Prepared Stament...?

jawwad ahmed
Ranch Hand

Joined: Dec 01, 2001
Posts: 179
Well i am not able to insert date with time with prepared stament.I dont know where i am going wrong.It gives error missing comma.

String qury = "insert into schedule (schedule_id,account_id,schedule_title,remarks,detail,to_date(schedule_date,'DD-MON-YY HH:MI')) values (?,?,?,?,?,?)";
PreparedStatement stmt2=dbConnection.prepareStatement(qury);
stmt2.setString(6,"03-APR-03 12:12");
int res=stmt2.executeUpdate();

SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
use setDate()
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Insert Date With Time Prepared Stament...?
It's not a secret anymore!