日期:2014-05-16 浏览次数:20402 次
对表里字段类型为:DATE
不同版本的OJDBC驱动包使用getObject出来的类型不同。
ojdbc14_10_2_0_4.jar出来的是java.sql.Date
ojdbc14.jar出来的是java.sql.Timestamp
Connection conn = null; PreparedStatement ptmt = null; ResultSet rs = null; conn = DriverManager.getConnection("jdbc:oracle:thin:@10.1.252.80:1521:newngboss", "so1", "so1"); ptmt = conn .prepareStatement("select ROWID,t.* from BAT_PRE_AUTHOR_TMP t where mod(BAT_PRE_AUTHOR_TMP_ID,2)=1 and check_state=1 and rownum <=100 "); ptmt.setFetchSize(100); rs = ptmt.executeQuery(); while (rs.next()) { System.out.println(rs.getObject("VALID_DATE").getClass()); rs.getObject("VALID_DATE"); }
?