java jdbc 遍历_java - 遍历3个不同的JDBC结果集 - 堆栈内存溢出

我正在尝试将3个不同表中的3个CSV文件压缩到单个zip文件your_files_12354627.zip 。

因此,我拥有以下方法,该方法适用于其中包含1个csv文件的zip文件生成。 我正在尝试对多个文件执行此操作,因此我修改了以下代码(如下工作代码所示):

下面的工作代码:

public void sendMessage(String msg) throws DaoException {

DataSource ds = null;

Connection conn = null;

PreparedStatement pstmt = null;

PreparedStatement pstmtEmployee = null;

PreparedStatement pstmtCompany = null;

PreparedStatement pstmBuilding = null;

ResultSet rs = null;

ResultSet resultSetFirst = null;

ResultSet resultSetSecond = null;

ResultSet resultSetThird = null;

String[] parts = msg.split("#");

String requestID = parts[0].trim();

String userName = parts[1].trim();

String applicationName = parts[2].trim();

try {

ds = jdbcTemplate.getDataSource();

conn = ds.getConnection();

pstmtEmployee = conn.prepareStatement(getPatientEmployeeSQL);

pstmtEmployee.setString(1, requestID);

resultSetFirst = pstmtEmployee.executeQuery();

pstmtCompany = conn.prepareStatement(getCompanySQL);

pstmtCompany.setString(1, requestID);

resultSetSecond = pstmtCompany.executeQuery();

pstmtBuilding = conn.prepareStatement(getBuildingSQL);

pstmtBuilding.setString(1, requestID);

resultSetThird = pstmtBuilding.executeQuery();

Path dir = Paths

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值