错误:the error is from OraclettleveoneCODao'e1---------ORA-01000: maximum open cursor
s exceeded我写了以下两个方法:
public String[] exetime(String rq1,String rq2,String hzmc,String hldm)
{
String[] rr = null;
try
{
conn = dbcm.getConnection();
DBAccess dba3 = new DBAccess(conn);
String selectSQL3 = "select distinct a.rq rq"
+" from t_fhzttl a,t_custom b"
+" where a.rq>='"+rq1+"' and a.rq<='"+rq2
+"' and a.tjhzdm=b.tjhzdm and b.name_cust like '"+hzmc
+"' and a.tjhldm like '"+hldm+"'"
+" order by a.rq";
System.out.println("selectSQL="+selectSQL3);
ResultSet rs3 = dba3.openSelect(selectSQL3);
rs3.last();
int i=rs3.getRow();
rs3.beforeFirst();
rr =new String[i];
i=0;
while(rs3.next())
{
rr[i]=rs3.getString("rq");
i++;
}
rs3.close();
dba3.closeSelect();
}
catch(Exception e1)
{
System.out.println("the error is from OracletimelistDao'e1"+e1.getMessage());
}
finally
{
try
{
dbcm.freeConnection(conn);
}
catch(Exception e2)
{
//
}
}
return rr;
}
public Collection exeeveline(String[] rq,String hzmc,String[] dwdm,String hldm)
{
Connection conn= null;
LinkedList ttlList = new LinkedList();
try
{
conn = dbcm.getConnection();
DBAccess dba3 = new DBAccess(conn);
String selectSQL3=null;
for(int i=0;i<dwdm.length;i++)
{
String[] dwttl=new String[rq.length];
for(int j=0;j<rq.length;j++)
{
selectSQL3="select nvl(sum(a.ttl),0) ttl"
+" from t_fhzttl a,t_custom b"
+" where a.rq='"+rq[j]
+"' and a.tjhzdm=b.tjhzdm"
+" and b.name_cust like '"+hzmc
+"' and a.tjhldm like '"+hldm
+"' and a.gndwdm = '"+dwdm[i]+"'";
ResultSet rs3 = dba3.openSelect(selectSQL3);
rs3.next();
dwttl[j]=rs3.getString("ttl");
rs3.close();
}
ttlList.add(dwttl);
String[] test = (String[])ttlList.getLast();
}
dba3.closeSelect();
}
catch(Exception e1)
{
System.out.println("the error is from OraclettleveoneCODao'e1---------"+e1.getMessage());
}
finally
{
try
{
dbcm.freeConnection(conn);
}
catch(Exception e2)
{
//
}
}
return ttlList;
}
然后我在jsp中:String[] rq = new OracletimelistDao().exetime(rq1,rq2,hzmc,hldm);
Iterator timeList = new OraclettleveoneCODao().exeeveline(rq,hzmc,dwdm,hldm).iterator();运行两三次就报上面的错误为啥呢?
请教
s exceeded我写了以下两个方法:
public String[] exetime(String rq1,String rq2,String hzmc,String hldm)
{
String[] rr = null;
try
{
conn = dbcm.getConnection();
DBAccess dba3 = new DBAccess(conn);
String selectSQL3 = "select distinct a.rq rq"
+" from t_fhzttl a,t_custom b"
+" where a.rq>='"+rq1+"' and a.rq<='"+rq2
+"' and a.tjhzdm=b.tjhzdm and b.name_cust like '"+hzmc
+"' and a.tjhldm like '"+hldm+"'"
+" order by a.rq";
System.out.println("selectSQL="+selectSQL3);
ResultSet rs3 = dba3.openSelect(selectSQL3);
rs3.last();
int i=rs3.getRow();
rs3.beforeFirst();
rr =new String[i];
i=0;
while(rs3.next())
{
rr[i]=rs3.getString("rq");
i++;
}
rs3.close();
dba3.closeSelect();
}
catch(Exception e1)
{
System.out.println("the error is from OracletimelistDao'e1"+e1.getMessage());
}
finally
{
try
{
dbcm.freeConnection(conn);
}
catch(Exception e2)
{
//
}
}
return rr;
}
public Collection exeeveline(String[] rq,String hzmc,String[] dwdm,String hldm)
{
Connection conn= null;
LinkedList ttlList = new LinkedList();
try
{
conn = dbcm.getConnection();
DBAccess dba3 = new DBAccess(conn);
String selectSQL3=null;
for(int i=0;i<dwdm.length;i++)
{
String[] dwttl=new String[rq.length];
for(int j=0;j<rq.length;j++)
{
selectSQL3="select nvl(sum(a.ttl),0) ttl"
+" from t_fhzttl a,t_custom b"
+" where a.rq='"+rq[j]
+"' and a.tjhzdm=b.tjhzdm"
+" and b.name_cust like '"+hzmc
+"' and a.tjhldm like '"+hldm
+"' and a.gndwdm = '"+dwdm[i]+"'";
ResultSet rs3 = dba3.openSelect(selectSQL3);
rs3.next();
dwttl[j]=rs3.getString("ttl");
rs3.close();
}
ttlList.add(dwttl);
String[] test = (String[])ttlList.getLast();
}
dba3.closeSelect();
}
catch(Exception e1)
{
System.out.println("the error is from OraclettleveoneCODao'e1---------"+e1.getMessage());
}
finally
{
try
{
dbcm.freeConnection(conn);
}
catch(Exception e2)
{
//
}
}
return ttlList;
}
然后我在jsp中:String[] rq = new OracletimelistDao().exetime(rq1,rq2,hzmc,hldm);
Iterator timeList = new OraclettleveoneCODao().exeeveline(rq,hzmc,dwdm,hldm).iterator();运行两三次就报上面的错误为啥呢?
请教
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货