gpt4 book ai didi

java - 错误 ORA-01000 : maximum open cursors exceeded

转载 作者:行者123 更新时间:2023-12-01 20:55:24 26 4
gpt4 key购买 nike

在 Eclipse 中,我收到此错误:**错误 ORA-01000:超出最大打开游标数我终于在 block 中关闭了连接,但我不知道为什么会收到此错误,这是我的代码 JAVA。请帮助我!

 for (DossierAMO dos = null; it.hasNext();) {
PreparedStatement ps = null;
ResultSet rs = null;
PreparedStatement ps2 = null;
ResultSet rs2 = null;
try {
dos = (DossierAMO) it.next();
//PreparedStatement ps = null;
//ResultSet rs = null;
/*try
*
{*/
System.out.println("Imma"+dos.getImma());
ps = cnnOracle.getConnexion().prepareStatement(
"select count(IMM_IMM_V_NUM_IMM) from d_salaire@prod_dist where SAL_C_DS =21 and IMM_IMM_V_NUM_IMM =?",
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY
);
ps.setString(1,dos.getImma());
rs = ps.executeQuery();
if (rs.next()){

if (rs.getInt(1) != 0)
//System.out.println("> Ecriture des dossiers d'indus dans le fichier d'indus2");
fichierIndius2.ecrireDossier(dos);
else
{


ps2 = cnnOracle.getConnexion().prepareStatement(
"select count(DOS_N_NUM_DOS) from d_dossier@prod_dist where IMM_IMM_V_NUM_IMM =?",
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY
);
ps2.setString(1,dos.getImma());
rs2 = ps2.executeQuery();
if (rs2.next()){

if (rs2.getInt(1) != 0)

fichierIndius2.ecrireDossier(dos);

else{
fichierIndius.ecrireDossier(dos);
}}}}
} catch (Exception ex) {
requete.fermer();

fichierIndius.fermerSansException();
fichierIndius2.fermerSansException();
cnnAS400.fermerConnexion();
cnnAS400FO.fermerConnexion();
cnnOracle.fermerConnexion();
System.err
.println("Erreur d'écriture dans le fichier d'indus! / EXC : "
+ ex);
return;
}
finally{

if (rs != null)
try {
rs.close();
} catch (Exception exx) {
}
if (rs2 != null)
try {
rs2.close();
} catch (Exception exx) {
}
if (ps != null)
try {
ps.close();
} catch (Exception exx) {
}
if (ps2 != null)
try {
ps2.close();
} catch (Exception exx) {
}
}






}

最佳答案

" i don't know why i'm getting this error"

会不会是这个错字?

            if (ps2 != null)
try {
ps.close();
} catch (Exception exx) {
}

您正在关闭 ps 而不是 ps2

关于java - 错误 ORA-01000 : maximum open cursors exceeded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42441092/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com