你的数据库是不是公用的?
有人在对同一个表写操作,没有commit,你的执行语句就要等在那里

解决方案 »

  1.   

    for (int i = 0; i < count; i++)
    是不是你的这个count有时大有时小呀?还有啊,有时执行慢是因为系统的缘故
      

  2.   

    count 当然有时大有时小啊,不然也不会有这种语句了。执行慢不是系统的缘故!
      

  3.   

    没有commit,你的执行语句就要等在那里,这种情况应该如何办呢?
      

  4.   

    Statement statement = con.createStatement();
          String newData = "insert into football values ('" + match[i].leagueName 
    ------------------------------------------------------------------------------
    建议把变量定义的语句放到循环的外面,内存里实例化了太多的对象,速度就会慢下来。在外面定义变量,对象才能重用。
      

  5.   

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //加载数据库相应的驱动程序    Connection con = DriverManager.getConnection(dbUrl, user, password); //建立连接
        con.setAutoCommit(false);
        Statement statement = con.createStatement();
        //System.out.println("建立连接!");
        for (int i = 0; i < count; i++) {
          //System.out.println("建立连接!");
          String tmp = "" + num;
          //Statement statement = con.createStatement();
          String newData = "insert into football values ('" + match[i].leagueName +
              "','" + match[i].matchTime + "','" + match[i].state + "','" +
              match[i].voiceCodeA +
              "','" + match[i].voiceCodeB + "','" + match[i].matchScoreA + "','" +
              match[i].matchScoreB + "','" + match[i].halfScoreA + "','" +
              match[i].halfScoreB +
              "','" + match[i].matchEvent + "','" + match[i].matchID + "','" + tmp +
              "','" +
              count + "','" + match[i].redA + "','" + match[i].redB + "')";      //statement.executeUpdate(newData);
          statement.addBatch(newData);
          // statement.close();    }    statement.executeBatch();  //运行到此就不动了!
         con.commit();//从此段开始不能运行,程序停在上面。
        statement.close();
        con.close();这是怎么一回事?救救我吧
      

  6.   

    statement.executeBatch() 返回值是多少?