我用的jndi数据连接池url里面已经加了 SelectMethod=Cursor
 <Resource name="jdbc/HMBST" auth="Container" type="javax.sql.DataSource"
               maxActive="500" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60" logAbandoned="true" username="sa" password="123456" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
               KeepAlive="off" testOnBorrow = "true" testOnReturn = "false"  testWhileIdle = "true"
               timeBetweenEvictionRunsMillis = "15000" numTestsPerEvictionRun = "10" minEvictableIdleTimeMillis = "600000" 
               url="jdbc:microsoft:sqlserver://192.168.3.8:1433;DatabaseName=HYXXCJ;SelectMethod=Cursor "/>
可是事务的时候还是报java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a cloned connection while in manual transaction mode.

解决方案 »

  1.   

    以下是事务部分代码: boolean returnValue = false; connection = getPoolConnection();
    try {
    // 设置自动提交
    setAutoCommit(false);
    // 设置sql语句及其参数
    setAddCommonInfoParams(all);
    preparedStatement = connection.prepareStatement(sql);
    // 设置preparedStatement的参数
    setParams();
    preparedStatement.executeUpdate(); // 设置sql语句及其参数
    setAddHaoBaiInfoToIndustryParams(all, industryCode);
    preparedStatement = connection.prepareStatement(sql);
    // 设置preparedStatement的参数
    setParams();
    preparedStatement.executeUpdate(); // 提交
    connection.commit(); returnValue = true;
    }
    catch (SQLException e) {
    rollback();
    e.printStackTrace();
    }
    finally {
    setAutoCommit(true);
    closeData();
    } // if (addCommonInfo(all)) {
    // return addHaoBaiInfoToIndustry(all, industryCode);
    // }
    return returnValue;