急救:ORA-00018: maximum number of sessions exceeded
办法想了N多个,还是不断的出现。
比如增加process,sessions数
连接池使用DBCP\WEBSPHERE自带都出错
数据库操作类代码:
public static Connection getConnection() throws Exception {
DataSource dataSource = null;
Connection conn = null;
try {
dataSource = ConnectionPoolListener.dataSource;
} catch (Exception e) {
throw e;
}
return conn;
}
public static List query(String cSql) throws Exception {
Statement stmt = null;
ResultSet rs = null;
Connection conn = null;
List list = null;
try {
conn = getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery(cSql);
RowBean rb = new RowBean(rs);
list = rb.getList();
} catch (ex) {
throw ex;
} finally {
if (rs != null) {
try {
rs.close();
} catch (Exception e)
}
rs = null;
}
if (stmt != null) {
try {
stmt.close();
}catch (Exception e) {
}
stmt = null;
}
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
conn = null;
}
}
return list;
}
public static synchronized void execute(String cSql) throws Exception {
Statement stmt = null;
Connection conn = null;
try {
conn = getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
stmt.executeUpdate(cSql);
} catch (Exception ex) {
throw ex;
} finally {
if (stmt != null) {
try {
stmt.close();
}catch (Exception e) {
}
stmt = null;
}
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
}
conn = null;
}
}
}