在 Sybase 數(shù)據(jù)庫中有一個(gè)數(shù)據(jù)庫過程(我無權(quán)訪問,因此無法查看或編輯它的源代碼),我查詢有關(guān)事件的信息,并且這些事件有開始和結(jié)束日期。編輯:當(dāng)我查詢一個(gè)新創(chuàng)建的日期表時(shí),也會發(fā)生這種效果,創(chuàng)建如下:create table jvo_test.test_dates(dt datetime not null primary key)insert into jvo_test.test_dates(dt) select dateadd(mi, (id-1) *30, '2019-03-06 00:00:00') from rle.row_generator where id between 1 and 48結(jié)束編輯問題是,當(dāng)這些事件發(fā)生在午夜后一小時(shí)(所以在 00:00 - 01:00 范圍內(nèi))時(shí),生成的時(shí)間戳?xí)谶^去一個(gè)小時(shí)內(nèi)跳回???示例:現(xiàn)在程序返回兩個(gè)事件,一個(gè)在 23:44,另一個(gè)在 00:07代碼:Connection c = ds.getConnection();String sql = "procedure_name 'param1', 'param2', 'param3'";PreparedStatement ps = c.prepareStatement(sql);ResultSet rs = ps.executeQuery();ResultSetMetaData rsmd = rs.getMetaData();while (rs.next()) { for(int i = 1; i < rsmd.getColumnCount(); i++) { log.debug("{} is of type: {}", rsmd.getColumnName(i), rsmd.getColumnType(i)); } log.debug("AS STRING start_time: {}, end_time: {}", rs.getString("start_time"),rs.getString("end_time")); log.debug("AS TIMESTAMP start_time: {}, end_time: {}", rs.getTimestamp("start_time"),rs.getTimestamp("end_time"));}這導(dǎo)致以下日志行start_time is of type: 93end_time is of type: 93AS STRING start_time: 2019-02-19 23:44:23.000000, end_time: 2019-02-19 23:44:29.000000AS TIMESTAMP start_time: 2019-02-19 23:44:23.0, end_time: 2019-02-19 23:44:29.0start_time is of type: 93end_time is of type: 93AS STRING start_time: 2019-02-20 00:0-53:46.000000, end_time: 2019-02-20 00:0-53:53.000000AS TIMESTAMP start_time: 2019-02-19 23:07:46.0, end_time: 2019-02-19 23:07:53.0start_time并且end_time都是類型 93 或時(shí)間戳。請注意,應(yīng)該從 00:07 開始的第二個(gè)事件如何跳到過去一個(gè)小時(shí)到 23:07這個(gè)一小時(shí)的偏移量我哪里錯(cuò)了?
1 回答

慕仙森
TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超8個(gè)贊
通過將 JDBC 數(shù)據(jù)庫驅(qū)動程序從內(nèi)部版本 26502 更新到 27361 解決了問題
要找出驅(qū)動程序的版本,請執(zhí)行
java -jar jconn4.jar
舊版本將此作為第一行輸出:
jConnect (TM) for JDBC(TM)/7.00(Build 26502)/P/EBF17993/JDK16/Thu Jun 3 3:09:09 2010
新版本輸出如下:
jConnect (TM) for JDBC(TM)/7.07 SP139 (Build 27361)/P/EBF27161/JDK 1.6.0/jdbcmain/OPT/Thu Jul 27 02:39:00 PDT 2017
添加回答
舉報(bào)
0/150
提交
取消