用两次createStatement,调两次数据库

解决方案 »

  1.   

    你可以成批操作.
    connection.setAutoCommit(false);
    Statement stmt=connection.getStatement();
    ...
    stmt.addBatch("create ...");
    stmt.addBatch("insert...");
    ...
    stmt.executeBatch();
    stmt.commit();
    不过要得到最后一行记录用不着成批更新
    Statement stmt=connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);//创建可随即滚动的SQL语句
    ResultSet resut=stmt.executeQuery(....);
    result.last();//光标移到最后一行
      

  2.   

    millions of thanks,多谢大家帮忙