mysql查询取前五百条数据,Java JDBC一次显示前500条记录,提交,显示下500条记录等...

该博客探讨了如何使用Java JDBC分批从MySQL查询并更新数据到Oracle数据库,每次处理500条记录,直到处理完所有记录。文章通过修改循环条件和添加批量执行检查来实现这一目标。
摘要由CSDN通过智能技术生成

So I want to be able to display 500 records at a time, commit and print that it has been displayed records 1 to 500 records have been committed. And than do the next 500 records and commit again until reached the maximum records which is over 20k records. I managed to get the first 500 records but I am stuck how can I commit them and in commit them and continue to get the next 500 records and so on.

public static void selectRecordsIcore() throws SQLException {

Connection dbConnection = null;

PreparedStatement preparedStatement = null;

Statement statement = null;

String selectTableSQL = "SELECT profile_id, ingress_flag, egress_flag, ce_ingress_flag, ce_egress_flag from COS_PROFILE"

+ " WHERE profile_id >= ? AND profile_id <= ?;";

try {

dbConnection = getInformixConnec

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值