在java 中用TimeStamp怎么接收oracle中的Date数据
展开全部
删掉这行:
Timestamp stamp = DateConventer.strWithtimeToTimestamp("2009-02-07 12:10:30");
改成
String stamp = "2009-02-07 12:10:30";
然后把:
String executeSql = "insert into TB_Tickets (TicketID,TicketName," +
"StadiumID,Price,Descn,BeginTime) values("+"seq_mp.nextval"+",?,?,?,?,"
+stamp+")";
改成:
String executeSql = "insert into TB_Tickets (TicketID,TicketName,"
+ "StadiumID,Price,Descn,BeginTime) values(" + "seq_mp.nextval"
+ ",?,?,?,?,to_date('" + stamp + "','yyyy-mm-dd hh24:mi:ss'))";
就可以了,试试看
按照你补充为题所说的,那你就需要使用PreparedStatement进行数据加载:
imestamp stamp = DateConventer.strWithtimeToTimestamp("2009-02-07 12:10:30");
String executeSql =".....";
PreparedStatement.setTimestamp(parameterIndex,Timestamp)
Timestamp stamp = DateConventer.strWithtimeToTimestamp("2009-02-07 12:10:30");
改成
String stamp = "2009-02-07 12:10:30";
然后把:
String executeSql = "insert into TB_Tickets (TicketID,TicketName," +
"StadiumID,Price,Descn,BeginTime) values("+"seq_mp.nextval"+",?,?,?,?,"
+stamp+")";
改成:
String executeSql = "insert into TB_Tickets (TicketID,TicketName,"
+ "StadiumID,Price,Descn,BeginTime) values(" + "seq_mp.nextval"
+ ",?,?,?,?,to_date('" + stamp + "','yyyy-mm-dd hh24:mi:ss'))";
就可以了,试试看
按照你补充为题所说的,那你就需要使用PreparedStatement进行数据加载:
imestamp stamp = DateConventer.strWithtimeToTimestamp("2009-02-07 12:10:30");
String executeSql =".....";
PreparedStatement.setTimestamp(parameterIndex,Timestamp)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-11-01
展开全部
使用java.util.Date类
追问
具体点
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询