jdbc读取oracle大量数据测试,成功用jdbc 实现从oracle 读取出一个时间间隔的数据...

成功用jdbc 实现从oracle 读取出一个时间间隔的数据

代码:

public static void test_find2() throws SQLException {

//创建连接

Connection conn = ConnTools.getConnection();

ResultSet rs = null;

//创建SQL执行工具

String sql = "select id,create_date from table_test where rownum<=10";

Statement stmt = conn.createStatement();

rs = stmt.executeQuery(sql);

while(rs.next()){

int id = rs.getInt("id");

Timestamp create_date = rs.getTimestamp("create_date");

System.out.println(id+":"+create_date + ":" + create_date.getClass().getName());

}

//关闭数据库连接

DbUtils.closeQuietly(conn);

}

结果:

1005:2010-02-27 10:21:19.0:java.sql.Timestamp1006:2010-02-27 11:12:57.0:java.sql.Timestamp1007:2010-02-27 14:28:02.0:java.sql.Timestamp1008:2010-02-27 14:43:34.0:java.sql.Timestamp1009:2010-02-27 14:47:53.0:java.sql.Timestamp1010:2010-02-27 14:51:07.0:java.sql.Timestamp1011:2010-02-27 14:52:51.0:java.sql.Timestamp1012:2010-02-27 15:06:10.0:java.sql.Timestamp1013:2010-02-27 15:07:47.0:java.sql.Timestamp1014:2010-02-27 15:08:28.0:java.sql.Timestamp

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值