说你的 CON是关闭的
a cloned connection --一个关闭的连接

解决方案 »

  1.   

    can't start a cloned connection while in manual transaction mode
                  closed?
    //JDBC-数据库的更新方式.txt//:SqlServerJdbcDirect.java
    import java.sql.*;public class SqlServerJdbcDirect {
    public static void main(String[] args){
      String dbUrl="jdbc:microsoft:sqlserver://tsc:1433;user=sa;password=mdzly109;DatabaseName=NorthWind";
    Connection con;
    Statement stmt;
    String user;
    ResultSet result=null;

    try{
      //使用MS提供的JDBC类。需要下载SQL Server的JDBC库。
      Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    }catch(ClassNotFoundException ex){
    ex.printStackTrace();
    } try{
        //简单的使用
        con = DriverManager.getConnection(dbUrl);          
          stmt=con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
            result=stmt.executeQuery("select * from Region");
        while (result.next()){        
           System.out.println(result.getInt(1)+"   "+result.getString(2));
           //由于该表的第一个字段是自动增量,不许更新,否则有异常
           //SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can not update, 
           //the specified column is not writable.
           //result.updateInt(1,result.getInt(1)+1);
           //更新的一个示例
           result.updateString(2, "tangshancheng"+result.getString(2)); 
               result.updateRow(); // updates the row in the data source
          }         
          result.close();
          con.close();
        }catch(SQLException ex){
    System.err.println("SQLException: " + ex.getMessage());
    }
    }
    }
      

  2.   

    很高兴看到你们的回复,我想我程序的所有与你所提供的简单例子不同的地方就是我在对某个修改的value是从另一个数据库中取来的,我马上在做一下普通的试验,看能否通过!做个解释:cloned的中文是克隆,也就是复制的意思!
      

  3.   

    谢谢各位,我已经解决!原来是我把autocommit 设为false的缘故!