Connection orcDbConn = getOracleConnect(); orcDbConn.setAutoCommit(false); PreparedStatement statement =orcDbConn.prepareStatement("INSERT INTO INVITEKEYTMP SELECT I.ID FROM INVITE I WHERE I.REBATE_STATE ='0' and INVITE_TIME>=TO_DATE(?,'yyyy-MM-dd') "); statement.setQueryTimeout(QUERY_TIMEOUT); statement.execute(); orcDbConn.commit(); <span style="font-family: Arial,Helvetica,sans-serif;">statement.close();</span><span style="white-space:pre"> </span>orcDbConn.close();
public Connection getOracleConnect() throws Exception { Connection orcDbConn = null; try { // 初始化驱动包 Class.forName(proCon.getProperty("driverClass")); // 根据数据库连接字符,名称,密码给conn赋值 orcDbConn = DriverManager.getConnection(proCon.getProperty("jdbcUrl"),proCon.getProperty("user"),proCon.getProperty("password")); } catch (Exception ex) { throw ex; } return orcDbConn; }原文链接:https://www.f2er.com/oracle/213634.html