Meaningless Drivel is fun!*
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Insert Date With Time Prepared Stament...?" Watch "Insert Date With Time Prepared Stament...?" New topic
Author

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.setInt(1,maxid);
stmt2.setString(2,accountId);
stmt2.setString(3,title);
stmt2.setString(4,remarks);
stmt2.setString(5,detail);
stmt2.setString(6,"03-APR-03 12:12");
int res=stmt2.executeUpdate();

response.sendRedirect("home.jsp");
////////////////////////////////////////////////////
SJ Adnams
Ranch Hand

Joined: Sep 28, 2001
Posts: 925
use setDate()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Insert Date With Time Prepared Stament...?
 
Similar Threads
cannot insert datetime type
Problem in inserting from one table to another
PreparedStatement problem
set ajax response in parent window field without refreshing the parent window
JDBC setDate (oracle driver).