代码太多了这个函数的一段是这样的
        if(tempNetCardArray!=null)
{  
  System.out.println("NetCard:"+tempNetCardArray.length);
for(i=0;i<tempNetCardArray.length;i++)
{
    if(!tempNetCardArray[i].store_radreply(timeout))
{   
    System.out.println("NetCard store_radreply Fail!"+i);
    return false;
    }
  }   
    }
////////////////////////////////////////////////////////////下面是store_radreply 函数
public boolean store_radreply(long MTime) 
{
long ltime,tempTime;
String tempUserTime;
ltime=MTime;

/* 获取连接 */
Connection con = Database.getConnection();
if (con==null) {
//建立数据库连接失败
return false;
}

ModeStrategy[] tempModeStrategy = Service.getService(this.serviceid).getModeStrategy();
if(tempModeStrategy == null)
{
Database.releaseConnection(con);
return false;
}
  String strAttriReply = new String("Session-Timeout");
  String strOpReply = new String(":=");

//start
        //修改上网卡,下面来更新数据库表
try {
//首先来删除原来的radcheck和radreply表 PreparedStatement pstmt=con.prepareStatement("delete from radreply where  attribute='Session-Timeout' and UserName like ?");
pstmt.setString(1,this.cardnumber+"@"+"%");
pstmt.executeUpdate();
pstmt.close();
//下面来根据相应的条件修改相应的数据库表
//根据不同的付费方式做不同的处理
if(this.cardstatus.equals("activated"))
{
if(this.cardbalance>0)
{
//按照正常方式修改radreply表
for(int i=0;i<tempModeStrategy.length;i++)
{
//首先根据用户的属性写radreply表
Strategy tempStrategy = tempModeStrategy[i].getStrategy();
NetMode tempNetMode = tempModeStrategy[i].getNetmode();


if(tempStrategy.getType().equals("time"))
 {
double tempFeerate = tempStrategy.getFeerate();
Double tempTimeout=new Double(this.cardbalance*3600/tempFeerate);
    tempTime=tempTimeout.longValue();
 if(tempTime<ltime)     
           ltime=tempTime;
   }
tempUserTime=String.valueOf(ltime);
pstmt=con.prepareStatement("INSERT INTO radreply (username,attribute,op,value) VALUES (?,?,?,?)");
pstmt.setString(1,this.cardnumber+"@"+tempNetMode.getName());
pstmt.setString(2,strAttriReply);
pstmt.setString(3,strOpReply);
pstmt.setString(4,tempUserTime);
pstmt.executeUpdate();
pstmt.close();
}
}
}


/* 返回 */
Database.releaseConnection(con);
return true;
} catch(Exception e) {
/* 释放连接 */
Database.releaseConnection(con);
return false;
}
//end//
} 当数据库测试数据到3000条以后程序执行就出错,出错时根据打印信息有时执行到2700左右,有时执行到2600多,每次都不一样。不知道什么原因