gpt4 book ai didi

java - 在java中查询与在mysql中不同

转载 作者:太空宇宙 更新时间:2023-11-03 11:06:37 24 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
MySql datetime not returning time

如果我从 consele mysql 执行此操作:

SELECT CREATION from MYDATABASE WHERE NAME='MyData';

我得到 2012-07-12 13:42:55

但如果从 Java 执行此操作:

  String sql = "SELECT CREATION from MYDATABASE WHERE NAME=?";
PreparedStatement ps = null;
String creationQuery;
ResultSet rs = null;
try
{
ps = conn.prepareStatement(sql);
ps.setString(1, "MyData");
rs = ps.executeQuery();

creationQuery = rs.next() ? rs.getString(1) : null;
}

我得到 2012-07-12 13:42:55.0

为什么?

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com