aspose file tools*
The moose likes JDBC 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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
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()
Consider Paul's rocket mass heater.
subject: Insert Date With Time Prepared Stament...?
Similar Threads
PreparedStatement problem
cannot insert datetime type
JDBC setDate (oracle driver).
Problem in inserting from one table to another
set ajax response in parent window field without refreshing the parent window