java - ORA-01000: 超出最大打开游标异常
问题描述
执行以下程序时出现异常“ORA-01000:超出最大打开游标”。请帮忙
public static void main(String[] args) throws ClassNotFoundException, SQLException
{
PreparedStatement ps = null;
Connection con = null;
ResultSet rs = null;
BufferedReader br = null;
try
{
String line = null;
while ((line = br.readLine()) != null)
{
if ((acctNumber != null) && (!acctNumber.trim().isEmpty()))
{
ps = con.prepareStatement("SELECT * FROM BANK WHERE ACCT_NBR = ?");
ps.setString(1, acctNumber);
rs = ps.executeQuery();
if (!rs.next())
{
logger.info("Account not present in BANK table: " + acctNumber);
}
else {
ps = con.prepareStatement("UPDATE BANK SET ------ WHERE ACCT_NBR = ?");
ps.setString(1, acctNumber);
ps.executeUpdate();
ps = con.prepareStatement("INSERT INTO BANK_NEW_BRANCH ------- ");
ps.setString(1, acctNumber);
ps.executeUpdate();
}
}
else
{
logger.info("Account Number is empty");
}
}
}
catch (SQLException e) {
logger.error("SQL Exception occured while executing the query " + e.getMessage());
}
br.close();
try
{
if ((rs != null) && (rs.isClosed())) {
rs.close();
}
if ((ps != null) && (ps.isClosed())) {
ps.close();
}
if ((con != null) && (con.isClosed()))
con.close();
}
catch (Exception e) {
logger.error("Exception occured while closing the connections, Exception details " + e.getMessage());
}
}
catch (IOException e)
{
logger.error("Exception occured", e.getMessage());
}
}
}
解决方案
推荐阅读
- curl - 如何在 curl API 中传递变量?
- netty - Netty4:IdleStateHandler 不会在 EmbeddedChannel 中触发事件
- android - 如何全屏显示微调器下拉菜单?
- vaadin - 使用 Metawidget 和 Vaadin 获取 java.lang.NoClassDefFoundError: com/vaadin/data/Property
- c++ - 将鼠标和键盘输入发送到 unity3d 游戏 (Rust)
- asp.net-mvc - 使用 WebApi 在 Angular 中进行 CRUD 操作
- unit-testing - mlUnitTest 不适用于 MarkLogic 单元测试
- laravel - 如何路由动态网址?
- openssl - EVP_AES_128_CTR
- mysql - 如何在mysql中使用in运算符传递变量?