Oracle Inactive Connections after connection.close()

Hi,
I've the following problem: although I close the oracle connection, the connection is kept inactive (in the oracle enterprise manager console), and after a while the maximum number of connections is reached.
I'm using the oracle oci8 driver (oracle 9.0.2).
is there anything else that I need to do to realy close the db connections ?
thanks,
Jo�o Portela

I don't know if this is your problem, but many programmers end up leaking connections by not handling the exceptions correctly.
You need to be doing something like:
try
// get connection
// do work
con.commit();
catch (Exception e)
LOG.Error("Something bad happened");
LOG.Error(e)
finally
con.close();
In other words, use finally to gurantee execution of close...

Similar Messages

  • Oc4j connection pool: too much INACTIVE connections

    I am publishing an application - developed using Eclipse and previously published in Tomcat (where it works perfectly for a long time) - within corporate servers using Oc4j version 10.1.3. The database server is Oracle 9g.
    After the deployment operation, the application seems to work, but that happens during the work by users, there are still many connections whith status "INACTIVE", until to complete all the available connections.
    The datasource is set as follows:
    <connection-pool name="ConnectionPoolRichiestaPubblicazione">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource"
    user="REDAZIONE"
    password="password"
    url="jdbc:oracle:thin:@(DESCRIPTION=(FAILOVER=ON)
         (ADDRESS_LIST=(LOAD_BALANCE=ON)
         (ADDRESS=(PROTOCOL=TCP)
         (HOST=10.146.2.86)(PORT=1521))
         (ADDRESS=(PROTOCOL=TCP)(HOST=10.146.2.86)(PORT=1521)))
         (CONNECT_DATA=
    (SERVER=DEDICATED)
    (SERVICE_NAME=XE)
    (FAILOVER_MODE=(TYPE=SELECT)(METHOD=BASIC)(RETRIES=180)(DELAY=5))))">
    </connection-factory>
    </connection-pool>
    <managed-data-source
    jndi-name="jdbc/RichiestaPubblicazioneDS"
    name="RichiestaPubblicazioneDS"
    connection-pool-name="ConnectionPoolRichiestaPubblicazione" />
    The java code to establish a connection is as follows:
    private Connection creaConnessioneDataSource(String nomedatasource) throws ConnessioneException{
              LOGGER.debug("START");
              try {
                   InitialContext context = new InitialContext();
                   DataSource ds = (DataSource)context.lookup(nomedatasource);
                   LOGGER.debug("URL DATASOURCE : " + ds.getConnection().getMetaData().getURL());
                   LOGGER.debug("USERNAME : " + ds.getConnection().getMetaData().getUserName());
                   this.conn = ds.getConnection();
              catch( Exception e ) {
                   LOGGER.error("Errore nella connessione tramite datasource : " + StringUtils.getCustomStackTrace(e));
              LOGGER.debug("END");
              return this.conn;
    Connections and statements are closed using the following methods:
         public boolean chiudi(Connection conn){
              LOGGER.debug("START");
              boolean esito = false;
              if (conn != null){
                   try {
                        conn.close();
                        esito = true;
                        LOGGER.debug("Connessione chiusa");
                   catch (SQLException e) {
                        LOGGER.error("Eccezione nella chiusura della connessione : " + e);
              LOGGER.debug("END");
              return esito;
         public boolean chiudi(Statement stmt){
              LOGGER.debug("START");
              boolean esito = false;
              if (stmt != null){
                   try {
                        stmt.close();
                        esito = true;
                        LOGGER.debug("Statement chiuso");
                   } catch (SQLException e) {
                        LOGGER.error("Eccezione nella chiusura dello statement : " + e);
                        e.printStackTrace();
              LOGGER.debug("END");
              return esito;
    Here are a couple of examples of code that interact with the database:
         public List<StatoRichiestaSintesi> getElencoStatiRichieste() throws ConnessioneException{
              LOGGER.debug("START");
              List<StatoRichiestaSintesi> listaStati=new LinkedList<StatoRichiestaSintesi>();
              LOGGER.debug("Apriamo connessione e statement");
              Connection conn = databaseManager.creaConnessioneDataSource(datasource);
              Statement stmt = databaseManager.creaStatement(conn, false);
              String sql="SELECT * FROM STATORICHIESTA";
              try {
                   ResultSet rs = stmt.executeQuery(sql);
                   while(rs.next()){
                        StatoRichiestaSintesi temp=new StatoRichiestaSintesi();
                        temp.setIdStato(rs.getString(1));
                        temp.setDescrizioneStato(rs.getString(2));
                        listaStati.add(temp);
                   LOGGER.debug("Numero record trovati : " + listaStati.size());
              } catch (SQLException e) {
                   LOGGER.error("Eccezione di tipo SQL : " + StringUtils.getCustomStackTrace(e));
              finally{
                   LOGGER.debug("Chiusura di statement e connessione");
                   databaseManager.chiudi(stmt);
                   databaseManager.chiudi(conn);
              LOGGER.debug("END");
              return listaStati;
    Below is another example using PreparedStatement:
         private synchronized void aggiungiIndicazioneProgetto(String idprogetto, String idrichiesta) {
              LOGGER.debug("START");
              LOGGER.debug("Creo un oggetto di tipo connessione");
              Connection conn = databaseManager.creaConnessioneDataSource(datasource);
              LOGGER.debug("Definisco una query sql");
              String sql = "INSERT INTO RICHIESTAPROGETTO (IDRICHIESTA,IDPROGETTO) VALUES (?,?)";
              LOGGER.debug("Dichiaro un oggetto di tipo preparedstatement");
              PreparedStatement stmt = null;
              try {
                   LOGGER.debug("Istanzio l'oggetto statement");
                   stmt = conn.prepareStatement(sql);
                   LOGGER.debug("Imposto i segnalibri della query");
                   stmt.setString(1, idrichiesta);
                   stmt.setString(2, idprogetto);
                   LOGGER.debug("Eseguo la query di inserimento del progetto");
                   stmt.executeUpdate();
              } catch (SQLException e) {
                   LOGGER.error("Eccezione di tipo SQL : " + StringUtils.getCustomStackTrace(e));
              finally {
                   LOGGER.debug("Chiusura di statement e connessione");
                   databaseManager.chiudi(stmt);
                   databaseManager.chiudi(conn);
              LOGGER.debug("END");
         Which may be the cause for the described behavior?
         I hope someone help me..

    My problem is the following.
    If I deploy my application with the illustred datasource in my local OC4J (10.1.3 in a Standalone Environment) all work fine.
    The application creates a reasonable number of connections (in ORACLE - 10g Enterprise Edition Release 10.2.0.4.0 - db I run the query verification "select count(*) from v$session where username='MYAPPLICATION'"), and overall performance is very good.
    If, however, to deploy on the production machine of corporate (always 10.1.3, but obviously in Oracle Application Server Environment) the
    number of connections (status 'INACTIVE') grows massively, and this is saturated in a short time.
    The exception that at the end from the application is that:
    java.sql.SQLException: ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Linux Error: 2: No such file or directory
    oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
    oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
    oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:277)
    oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
    oracle.jdbc.driver.T4CTTIoauthenticate.receiveOsesskey(T4CTTIoauthenticate.java:243)
    oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:304)
    oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:430)
    oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:151)
    oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:608)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:218)
    oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:114)
    oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:77)
    oracle.jdbc.pool.OracleImplicitConnectionCache.makeCacheConnection(OracleImplicitConnectionCache.java:1361)
    oracle.jdbc.pool.OracleImplicitConnectionCache.getCacheConnection(OracleImplicitConnectionCache.java:441)
    oracle.jdbc.pool.OracleImplicitConnectionCache.getConnection(OracleImplicitConnectionCache.java:336)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:286)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:179)
    oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:159)
    oracle.oc4j.sql.DataSourceConnectionPoolDataSource.getPooledConnection(DataSourceConnectionPoolDataSource.java:57)
    oracle.oc4j.sql.xa.EmulatedXADataSource.getXAConnection(EmulatedXADataSource.java:92)
    oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createXAConnection(ManagedConnectionFactoryImpl.java:211)
    oracle.oc4j.sql.spi.ManagedConnectionFactoryImpl.createManagedConnection(ManagedConnectionFactoryImpl.java:170)
    com.evermind.server.connector.ApplicationConnectionManager.createManagedConnection(ApplicationConnectionManager.java:1377)
    oracle.j2ee.connector.ConnectionPoolImpl.createManagedConnectionFromFactory(ConnectionPoolImpl.java:327)
    oracle.j2ee.connector.ConnectionPoolImpl.access$800(ConnectionPoolImpl.java:98)
    also I add the other attributes of Connection Pool of the Datasource:
    Connections:
    Initial size of Connection Cache = 0     
    Minimum Number of Connections = 0
    Maximum Number of Connections = -1
    Connection Retry Interval (seconds) = 1
    Maximum Connection Attempts = 3
    Maximum Number of Statements Cached = 0     
    Lower Threshold Limit On Pool (%)= 20     
    Validate Connection = False
    What I can do?
    many thanks..

  • BC4J DO NOT RE-USE THE ''INACTIVE'' CONNECTIONS, DATABASE IS SATURATED

    We developed a J2EE Web application based on the BC4J Framework.
    We're using JDevelopper 9.0.3.2 (9.0.2.822 before). The web application is rolled out on Oracle
    9ias 9.0.2 patchset 3.
    The database used is oracle 9i 9.2.0.
    We used the following code to connect to the BC4J:
    public void openConnection() {
    m_appModule = null;
    while (m_appModule == null)
    try
    m_appModule =
    Configuration.createRootApplicationModule(
    m_sAppModuleName,m_sAppModuleConfigName);
    } catch (JboException e) {
    if
    (e.getErrorCode().equalsIgnoreCase(AMPoolMessageBundle.EXC_AMPOOL_COOK
    IE_ALREADY_EXISTS)){
    try {
    Thread.currentThread().sleep(5);
    } catch (InterruptedException m) {
    }else
    throw e;
    The following code closes the connection to the BC4J
    public void closeConnection() {
    Configuration.releaseRootApplicationModule(m_appModule,true);
    m_appModule = null;
    The pooling parameters are the same as the default ones in Jdevelopper.
    We noted that certain connections created by the BC4J in the database were
    turned "inactive" and were never re-used.
    After a certain time, "inactive" connections multiply and the database is
    completely saturated.
    The BC4J do not re-use the "inactive" connections but try to create new ones.
    The "inactive" connections that are never re-used are never killed.
    Our only solution is to reboot the database server or the application OC4J
    instance to suppress the "inactive" connections.
    We tried to configure the BC4J pool in Jdeveloper, but it doesn't work in 9IAS.
    Could you please clarify what the problem is? Looking forward to receiving your
    feedback on this pressing issue, regards.
    Stéphane CHEVALLET

    I'm hitting the same problem.
    have you managed to solve it ? please share your wisdom :)
    Best Regards
    Rui Madaleno

  • Inactive Connections Problems

    Hi,
    I have an ASp.NET (C#) application, using OLEDB driver, Oracle 9i. Using the normal string connection we have some problems, because when we close the connection, it still opened, inactive but opened in the DB. What should I do to kill the inactive connections?
    Thank's
    Message was edited by:
    JP®

    Hi Sergio,
    I found some answers here. Some people said that the right way to deal and end with Inactive Connections, is creating a new profile, and setting a value to the idle_time parameter, ex: idle_time=3, so after 3 minutes inactive the connection is severed. Or creating a procedure, and this procedure will deal and kill the inactive connections.
    I don't know what else I can do?
    But, I'm sorry, I thought that here is the right forum, thank you for the information, I'll post it in the right one.
    JP®

  • Forcibly releasing inactive connection  BEA-001153

    Hello there!, here at work we use Jdeveloper 11.1.3.0 , with JNDI Data Sources to access database (configured from WLS) My DataSource config is:
    <?xml version='1.0' encoding='UTF-8'?>
    <jdbc-data-source xmlns="http://xmlns.oracle.com/weblogic/jdbc-data-source" xmlns:sec="http://xmlns.oracle.com/weblogic/security" xmlns:wls="http://xmlns.oracle.com/weblogic/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.oracle.com/weblogic/jdbc-data-source http://xmlns.oracle.com/weblogic/jdbc-data-source/1.0/jdbc-data-source.xsd">
      <name>arq</name>
      <jdbc-driver-params>
        <url>jdbc:oracle:thin:@192.168.101.**:1521/HLSEDB</url>
        <driver-name>oracle.jdbc.OracleDriver</driver-name>
        <properties>
          <property>
            <name>user</name>
            <value>dbadmin</value>
          </property>
        </properties>
        <password-encrypted>{AES}6mOLLY92ueqAFcFK3k29k/SUeCy/qgp1a9HGsHsCTg4=</password-encrypted>
      </jdbc-driver-params>
      <jdbc-connection-pool-params>
        <initial-capacity>1</initial-capacity>
        <max-capacity>15</max-capacity>
        <capacity-increment>1</capacity-increment>
        <shrink-frequency-seconds>900</shrink-frequency-seconds>
        <highest-num-waiters>2147483647</highest-num-waiters>
        <connection-creation-retry-frequency-seconds>0</connection-creation-retry-frequency-seconds>
        <connection-reserve-timeout-seconds>10</connection-reserve-timeout-seconds>
        <test-frequency-seconds>120</test-frequency-seconds>
        <test-connections-on-reserve>false</test-connections-on-reserve>
        <ignore-in-use-connections-enabled>true</ignore-in-use-connections-enabled>
        <inactive-connection-timeout-seconds>360</inactive-connection-timeout-seconds>
        <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name>
        <login-delay-seconds>0</login-delay-seconds>
        <statement-cache-size>10</statement-cache-size>
        <statement-cache-type>LRU</statement-cache-type>
        <remove-infected-connections>true</remove-infected-connections>
        <seconds-to-trust-an-idle-pool-connection>10</seconds-to-trust-an-idle-pool-connection>
        <statement-timeout>-1</statement-timeout>
        <pinned-to-thread>false</pinned-to-thread>
      </jdbc-connection-pool-params>
      <jdbc-data-source-params>
        <jndi-name>jdbc/arq</jndi-name>
        <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol>
      </jdbc-data-source-params>
    </jdbc-data-source>Minutes after deploying mi application, console starts to show :
    <JDBC> <BEA-001153> <Forcibly releasing inactive connection "weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_T4CConnection@22e" back into the connection pool "SegDS", currently reserved by: java.lang.Exception
         at weblogic.jdbc.common.internal.ConnectionEnv.setup(ConnectionEnv.java:318)
         at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:344)
         at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:322)
         at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:438)
         at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:317)
         at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:93)
         at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:106)
         at weblogic.jdbc.pool.Driver.connect(Driver.java:149)There's any best practice or guide to configure my Datasource? or we should avoid JNDI's and start to use only appmodule connection?
    Thanks !

    I found the answer for this issue, because "Inactive timeout connection" of "advanced" in "data sources" of welogic admin console set to 300 seconds, once we changed to "zero". This msg is gone.

  • How does inactive connection timeout attribute in weblogic works ?

    Lets say If there is a connection leakage in my application running on weblogic server 10.3.4 and I want to regain the unclosed connection.
    After going through some documentation I found out that setting inactive connection timeout to a positive value can fix this issue.
    With setting the above attribute will the weblogic server close any connection object which is inactive for specified number of seconds or it acts on only
    those connection objects which has lost all the references to it ?
    demonstrating the query by an example ,
    Lets say I have two connection objects con1 & con2 taken from a defined datasource in the weblogic.
    the inactive timeout has been set to 10 seconds.
    In a given thread lets say con1 does some db operation and then after being done, con2 is used for another db operation for greater than 10 seconds.
    Will the object con1 be still available for db operation or we need to take a fresh connection from the pool ?
    Thanks,
    Tarique
    Edited by: user779368 on 30-May-2011 06:29

    Any connection that has been reserved by an application, and not used for longer than
    the inactive timeout limit, will be taken back by the pool. All it's sub-objects will be closed etc.
    In your case, you would lose con1 while con2 was being used. Ideally, you would get
    any/either of those connections at the instant you really need it. Then, ideally use it
    till you can close it. But if you are doing transactions or a job that need connections,
    but can't avoid having them idle for X seconds, then set your inactive timeout larger than X.

  • Tomcat 5.5.20 / Oracle  JDBC connection error

    Hi All,
    I am using Eclipse 3.2/ Tomcat 5.5.20/ Oracle 8i
    Inside my java class; right after finding the context, it gives error on line:
    conn = dataSource.getConnection();
    my server.xml <Resource> settings are proper within one tag...
    I am loosing my hair faster... please someone help me..
    Error Stack:
    javax.servlet.ServletException
         org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    root cause
    java.lang.NullPointerException
         com.nibtt.beans.ConnectionBean.getConnection(ConnectionBean.java:80)
         com.nibtt.actions.LoginAction.execute(LoginAction.java:44)
         org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Regards
    Hepzi

    Hi Zadok,
    I am going insane. Thank God you replied. I am pasting my code here.
    I have setup Tomcat5.5.20 <resource> tag as follows: for connection pooling
    <Resource      name="jdbc/TestStrutsDB" auth="Container"
              type="javax.sql.DataSource" factory="org.apache.commons.dbcp.BasicDataSourceFactory"
              username="SCOTT" password="TIGER"
              driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@111.1.1.1:1521:TEST"
              maxActive="8" maxIdle="4"/>
    my application web.xml code:
    <resource-ref>
    <description>Oracle DB Connection</description>
    <res-ref-name>jdbc/TestStrutsDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    my java code:
    public Connection getConnection() throws Exception{
              Context ctx = new InitialContext();
    Context envContext = (Context)ctx.lookup("java:/comp/env");
    javax.sql.DataSource dataSource = null;
         ResultSet rst = null;
         Statement stmt = null;
         try {
              if(envContext == null ) {
         System.out.println( "context is NULL");
              } else
         System.out.println( "context is NOT NULL");
    dataSource = (javax.sql.DataSource)envContext.lookup("jdbc/TestStrutsDB");
              if (dataSource != null) {
                   System.out.println( "before actual connection to database: "+dataSource.toString() );
                   try {
                        conn = dataSource.getConnection();
                   } catch (Exception connEx) {
                        System.out.println( connEx.getStackTrace());
              if(conn != null) {
         System.out.println( "Got Connection "+conn.toString());
         stmt=conn.createStatement();
         rst=stmt.executeQuery("select username from testTomcat");
         while(rst.next()){
              System.out.println("User Name is: " + rst.getString("username"));
         rst.close();
         rst = null;
         stmt.close();
    stmt = null;
    conn.close();
         conn = null;
         // do what you wish with Connection
         } catch (SQLException e) {
              while((e = e.getNextException()) != null) {
                        System.out.println("SQLException: " + e.getMessage());
                        System.out.println("SQLState: " + e.getSQLState());
                        System.out.println("VendorError: " + e.getErrorCode());
                        System.out.println(e.getStackTrace());
         } finally {
         try {
         conn.close();
         } catch (SQLException ex) {
              System.out.println(ex.getStackTrace());
              return conn;
         } //End of Connection function
    Please let me know if had gone wrong somewhere
    Thanks in advance
    Regards
    Hepzi

  • Inactive connections

    I am using Oracle, java, jsp, JNDI datasource look up for this web application. The application makes numerous connections with database, executes queries, load the results into arraylists or vectors and connections get closed as soon as the resultset is loaded into a collection object.
    when I was load testing, I found out several inactive connections in the database side. This is so puzzling. I have been struggling for more than I should.
    these are my datasource settings in my server.xml file:
    <ResourceParams name="jdbc/myoracle">
    <parameter>
    <name>factory</name>
    <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value>
    </parameter>
    <parameter>
    <name>url</name>
    <value>jdbc:oracle:oci8:@mydb</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>user</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>pass</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>20</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>20</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>20000</value>
    </parameter>
    </ResourceParams>
    Please HELP!!!!!
    Suraj

    Hi,
    It may be due to the connection pooling used.
    A "closed" (to application context) connection is
    returned to the pool for later reused, (in database
    context, these connection is still open).
    May be can find out more from the dbcp API?Hi
    Anybody has any problems with this and has anybody found solutions?
    I am setting up the maxActive datasource parameter value as 20 and maxIdle parameter 20. but these parameters are getting completely ignored. when I load tested, there are 55 active and inactive connections together even after each time the connection, statement and resultset are closed.
    I think It is to do with tomcat. When I restart tomcat, all the connections disappear.
    Suraj

  • Web app Connection.close()...how to prevent

    Hello
    I am somewhat new to this, but I am developing an web application that will be a help desk of sorts for clients to log on and create trouble tickets, plus many other features. I have completed the project and it works fine when I first start tomcat but an unexpected state keeps occurring and I can't seem to figure it out.
    After a while (I say a while cause I'm not sure exactly how long, but I'd say +5 hours) my application no longer will work and in the tomcat log I get the following message.
    Could not execute a query statement!Connection.close() has already been called. Invalid operation in this state.
    java.sql.SQLException: Connection:close() has already been called.
    at com.mysql.jdbc.Connection.getMutex(Connection.java:1906)
    at com.mysql.jdbc.Statement.executeQuery(Statement.java:1115)
    at brokers.RelationalBroker.query(RelationalBroker.java:171)
    the RelationalBroker.java is
    package brokers;
    * Created on May 12, 2004
    * Class: RelationalBroker
    * Package: brokers
    * On-Track, Ticket Tracking System
    * @author
    * @version
    * This Class is used as the super class for all of the child brokers
    * for the database. The main purpose if this class is to allow all the
    * child classes to share the open connection to the database and execute
    * queries and updates on the database. This class is part of the brokers
    * package.
    //imports
    import java.sql.*;
    public class RelationalBroker {
        //Instance Attributes
         * The attribute con represented by a Connection object is used to hold
         * the active connection to the database. This connection is shared with
         * all of the child brokers.
        private Connection con = null;
         * The attribute statement represented by a Statement object is used to
         * execute the query and update statements on the database by the child
         * brokers.
        private Statement statement = null;
         * The attribute results represented by a ResultSet is used to hold
         * the results of a query executed on the database.
        private ResultSet results = null;
        //Constructors
         * Default constructor used to create a RelationalBroker object.
        public RelationalBroker(){
        //     Getters
         * The Getter getCon is used to get the Connection object.
         * @return Connection con.
        public Connection getCon() {
            return con;
         * The Getter getResults is used to get the ResultSet results.
         * @return ResultSet results.
        public ResultSet getResults() {
            return results;
         * The Getter getStatement is used to get the Statement object.
         * @return Statement statement.
        public Statement getStatement() {
            return statement;
        //Methods
         * The method connect is used to connect to the database given a username
         * password, location of driver, and URL of the database. This method also
         * creates the Statement object to be used for queries ans updates on the database.
         * @param driver A String containing the location of the database driver.
         * @param URL A String containing the location of the database on a netowrk.
         * @param user A String containing the username of the database account.
         * @param pass A String containing the password of the database account.
        public void connect(String driver, String URL, String user, String pass){
            try{
                Class.forName(driver);
                con = DriverManager.getConnection(URL, user, pass);
                statement = con.createStatement();
            catch (ClassNotFoundException cExp){
                System.out.println("Cannot find class for driver");
            catch (SQLException sqle){
                System.out.println("Error opening table or creating statement!: " + sqle.getMessage());
                sqle.printStackTrace();
                System.exit(0);
         * The method closeConnection is used to close the active connection
         * to the database.
         * @return A boolean containing the status of the connection, True if closed
         * false if open.
        public boolean closeConnection(){
            boolean isClosed = false;
            try{
                con.close();
                isClosed = con.isClosed();
            catch(SQLException sqle){
                System.out.println("Error closing connection!" + sqle.getMessage());
            //finally{
            return isClosed;
         * The method rollBack is used to execute a rollback statement on
         * the database, to undo any changes since the last commit.
         * @return void
        public void rollBack(){
            try{
                con.rollback();
            catch(SQLException sqle){
                System.out.println("Could not execute a  Rollback statement!" + sqle.getMessage());
                sqle.printStackTrace();
         * The method commit is used to execute a commit statement on the
         * database, to make any changes final.
         * @return void
        public void commit(){
            try{
                statement.executeUpdate("commit");
            catch (SQLException sqle){
                System.out.println("Could not execute a commit statement!" + sqle.getMessage());
                sqle.printStackTrace();
         * The method query is used to exceute a query statement on the
         * database to get back some results.
         * @param query A String containing the query to be executed on the database
         * @return a ResultSet containing the results.
        public ResultSet query(String query){
            results = null;
            try{
                //System.out.println("query: "+query);
                results = statement.executeQuery(query);
            catch(SQLException sqle){
                System.out.println("Could not execute a query statement!" + sqle.getMessage());
                sqle.printStackTrace();
            //finally{
            return results;
         * The method update is used to persist or remove information
         * from the database.
         * @param update String containing the update string to be exceuted;
        public void update(String update){
            try{
                statement.executeUpdate(update);
            catch(SQLException sqle){
                System.out.println("Could not execute an update statement!" + sqle.getMessage());
                sqle.printStackTrace();
    }//end classmy web.xml file to initialize with the database is as follows
    <servlet>
              <servlet-name>Connection</servlet-name>
              <servlet-class>servlets.ConnectionServlet</servlet-class>
              <init-param>
                   <param-name>url</param-name>
                   <param-value>jdbc:mysql://localhost/TICKETTRACK</param-value>
              </init-param>
              <init-param>
                   <param-name>driver</param-name>
                   <param-value>com.mysql.jdbc.Driver</param-value>
              </init-param>
              <init-param>
                   <param-name>user</param-name>
                   <param-value>---</param-value>
              </init-param>
              <init-param>
                   <param-name>password</param-name>
                   <param-value>---</param-value>
              </init-param>
              <load-on-startup>1</load-on-startup>
         </servlet>
    the ConnectionServlet.java is
    package servlets;
    import javax.servlet.http.*;
    import javax.servlet.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import problemDomain.*;
    import brokers.*;
    * Title:
    * Description:      This servlet is used to create a connection with .
    * @author
    * @version 1.0
    public class ConnectionServlet  extends HttpServlet{
        private UserBroker uBroker;
        private TicketBroker tBroker;
        private CompanyBroker cBroker;
        public void init() throws ServletException{
            ServletConfig config = getServletConfig();
            String user = config.getInitParameter("user");
            String pass  = config.getInitParameter("password");
            String url  = config.getInitParameter("url");
            String driver = config.getInitParameter("driver");
            uBroker = UserBroker.getUserBroker();
            tBroker = TicketBroker.getTicketBroker();
            cBroker = CompanyBroker.getCompanyBroker();
            uBroker.connect(driver,url,user,pass);
            tBroker.connect(driver,url,user,pass);
            cBroker.connect(driver,url,user,pass);
    /*  This method is used to close the connection.
    *  @param none
    *  @return none.
        public void destroy() {
            try{
            }catch(Exception ec){
                System.err.println(ec);
    }I hope this is enough information for someone to help out. I'm out of ideas and my searches on the web didn't turn up much.
    I was thinking it was something to do with ConnectionPooling but I have never done that, or maybe its something to do with how I set up Connections or maybe its my Tomcat config or something to do with Mysql. I'm not even calling a Connection.close(), maybe that is my problem.
    Any help would be greatly appreciated, I'm not just looking for an answer I really would like to know why this occurs and how it can be prevented.
    Thanks,

    I really appreciate your reply and I can understand what you mean in theory(I think) but to actually implement it I'm having a little trouble.
    So for this database pool, in my ConnectionServlet which gets initialized on startup, should I create a Collection of connections for each instance(make them local), and than create another method to retrieve one of these connection when needed and when finished release it back to the collection(close)? Or is there some built in mechanism that can easily do this?
    I'm also reading up on that keep-alive you mentioned...it applies to the HTTP Connector element right? Is there a way to tell if this is an issue? I'm using Tomcat 5 and mySQL 3. I was talking with another guy here about using a connector to apache so it will work with the static pages and Tomcat do the servlet stuff, but I'm still trying to grasp all that.
    I don't know if this matters but many instances/windows of the web app can be opened at one time with seemingly no problems.
    Hope this made sense, like I said I'm pretty new to this so all I'm used to is simple configurations of web apps but hopefully I can advance further.
    Thanks again,

  • Database Table Resource via Oracle RAC connection Manager

    Hello,
    Our current IDM 8.1 syncs off a HR Database Table using the Database Table connector.
    Our DBA's are moving the view into an Oracle RAC environment.
    Question: Is there a way for us to connect and sync off our DB table through an Oracle RAC connection manager.
    I understand that for the IDM repository, this is possible.
    jdbc:oracle:thin@(DESCRIPTION =
    (ADDRESS_LIST =
    (LOAD_BALANCE = ON)
    (FAILOVER = ON)
    (ADDRESS = (PROTOCOL = TCP)(HOST = server1.ser.com)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = server2.ser.com)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = db.com)
    servers server1 and server2 are oracle connection managers
    Thank you for your input,
    -RC

    We moved the repository to Oracle RAC recently. The syntax to switch to the new databasecluster was something like this:
    lh setRepo -tOracle -ujdbc:oracle:thin:@//dbcluster1.domain:1521/service_idm.oradb.domain -Uwaveset -Pwachtwoord
    For the 'lh setRepo' command the old database had to be up, and we had to use the old ojdb5.jar. After that we switched to ojdb6.jar.
    One of our resources is a database table with HR data in the same database. The following Database Access Parameters work for us:
    Database Type:      Oracle
    JDBC Driver:      oracle.jdbc.driver.OracleDriver
    JDBC URL Template:      jdbc:oracle:thin:@//%h:%p/%d
    Host :     dbcluster1.domain
    Database: service_idm.oradb.domain
    Port: 1521
    Greetings,
    Marijke

  • Inactive connections in database

    Hi,
    I'm using Oracle 10 with my Weblogic 8.1. I'm having cluster environment with 3 managed servers. Each is having initial capacity of 30 connections in connection pool. Now when I see my oracle database, its showing 90 INACTIVE connections. What does that mean? Is it related to Weblogic? If yes, how?

    Hello.
    Well, connection pool are well describe at some good places, I will try. The WLS admin setup a connection pool which consist in a number of connection on a database with the same loginname/password.
    Those connections are opened on WLS startup and are ready for application use. When an application needs a connection, it asks for one, and WLS gives a already opened one. Doing so, you don't have to connect to the database each time, as the connection already exists.
    When the application is done with the connection, it releases it and this connections returns in pool.
    Rgds.

  • Crystal Reports - Oracle server connection

    Hi Guys,
    I'm back to struggling with Crystal Reports XI Release 2.
    I'm trying to display a report that retrieves a set of data from an oracle database.
    I've got the following scenarios:
    - If I build a report using a JDBC connection and setting its properties from the crystal reports designer It works perfectly
    - If i build the same report using a connection type called Oracle Server and check the option SAVE DATA WITH REPORT works fine
    - The failure scenario is, creating the same report by using an Oracle server connection and disabling the SAVE DATA WITH REPORT option. I get the error message: Database logon failed. Database Vendor Error Code: 17002
    I've set a JDNI datasource in Tomcat already, and still getting the same error, as well as including this tag in my application web.xml
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>oraclevt</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    Please, let me know if you have any hint regarding this issue as I've run out of ideas to sort it out.
    Thank you.
    Esteban.

    Hey evnafets how r u doing? Thanks very much for your reply.
    I checked the TNSName and looks fine, and it does match the JNDI name I created through the Tomcat Administration Tool.
    I tested the JNDI connection a couple of days ago and it didn't come through, it keeps giving me an error, even though I've verified everything is properly set and configured. The error message is:
    org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
    This is the snipped code, si quite simple actually.
    System.out.println("Starting initial context");
                   Context initCtx = new InitialContext();
                   Context envCtx = (Context) initCtx.lookup("java:comp/env");
                   DataSource ds = (DataSource)
                   envCtx.lookup("jdbc/OFIC09FL");
                   Connection conn = ds.getConnection();
                   //... use this connection to access the database ...
                   conn.close();
    I've googled this issue and have not found a helpful solution. I guess this all the Crystal connection issue, don't you think? Any hints to make the jsp-jndi test work?
    Regards,
    Esteban.

  • Unable to log into Discoverer Plus - oracle.discoiv.connections.Connection

    Hello,
    Discovoerer Plus and Viewere were working fine last week and today an attempt to login gives this error on the page:
    A connection error.
    - error while creating the session, check for other errors.
    - oracle.discoiv.connections.ConnectionStoreException: weblogic.common.resourcepool.ResourceDeadException: 0: Could not connect to 'oracle.jdbc.OracleDriver'. The returned message is: ORA-01017: invalid username/password; logon denied It is likely that the login or password is not valid. It is also possible that something else is invalid in the configuration or that the database is not available.
    - weblogic.common.resourcepool.ResourceDeadException: 0: Could not connect to 'oracle.jdbc.OracleDriver'. The returned message is: ORA-01017: invalid username/password; logon denied It is likely that the login or password is not valid. It is also possible that something else is invalid in the configuration or that the database is not available.
    - weblogic.common.resourcepool.ResourceDeadException: 0: Could not connect to 'oracle.jdbc.OracleDriver'. The returned message is: ORA-01017: invalid username/password; logon denied It is likely that the login or password is not valid. It is also possible that something else is invalid in the configuration or that the database is not available.
    unable to retrieve connection list
    - Cannot retrieve connection list. Check the Discoverer application log for more details.
    JFYI
    Discoverer is installed on the same server as EBS 12i.
    Last week we had issues when EBS promoted us to change the passwords of apps, SYSADMIN, APPLSYSPUB and even that of EUL4_US in the system. I am wondering which of these changes could have had an impact on Discoverer. How do I get ebs to recognize the new password of EUL4_US?
    Thanks

    Hi Mathias
    Let me answer at least a couple of your issues:
    +3) I have installed Oracle Discoverer Administrator on an XP manchine but at startup, it doesn't display the "Applications checkbox". Did I miss this during installation and can I simply reinstall?+
    EUL5_US connects find at this window and I am greeted with the Load Wizard Step 1. Does it mean that to connect as sysadmin, I have to reinstall this BI Discoverer?
    You have to enable Discoverer Admin in APPS mode, it does not do it automatically. To do that follow this workflow:
    1. Connect to Discoverer Admin as EUL5_US
    2. On the Load Wizard Step 1 click the Cancel button
    3. From the menu bar select Tools | Options and navigate to the Connection tab
    4. Check the button labeled Connect to both standard and application EULs
    5. In the box labeled Gateway User enter: applsyspub/pub
    6. In the box labeled Foundation Name enter: apps
    7. Click the OK button
    8. From the menu bar select File | Connect
    9. This time you should see the Oracle Applications User check box.
    On the XP machine you need to also have the DBC file and tnsnames files. Here's how to enable the DBC security:
    1. Create a folder under c:\Oracle called Secure so that you could have: c:\oracle\secure
    2. Place your DBC file in this folder
    3. Launch Control Panel
    4. Select System | Advanced System Settings - this opens the System Properties box
    5. Click the Environment Variables button - this opens the Environment Variables box
    6. In the bottom half of the screen, labeled System variables click the New button - this opens the New System Variable box
    7. In Variable Name enter: FND_SECURE
    8. In Variable Value enter: c:\oracle\secure
    9. Click the OK button to close the New Variable box
    10. Click the OK button to close the Environment Variables box
    11. Click the OK button to close the System Properties box
    12. Close Control Panel
    This should get Discoverer Admin working. Can you check and let me know?
    As far as I know there are no additional passwords. If Discoverer Admin can be made to work using SYSADMIN then there is a setup issue on the server. Most likely the FND_SECURE is not picking up the location for the DBC but let's tackle that once we get Admin working.
    Best wishes
    Michael

  • ACE 4710 send Connection:Close when should be Keep-Alive

    After user request to front end http to 10.85.10.4 (default 80) after a port redirect and action list header rewrite
    header rewrite request host header-value http://10[.]85[.]10[.]4 replace http://10.85.10.67:84/jde/E1Menu.maf%1
    I see the request go out (wireshark) to the back-end javaserver but in the Connection it's close not keepalive:
    GET /jde/E1Menu.maf HTTP/1.1
    Connection: Close
    Host:10.85.10.67:84
    After the get from the ACE the jserver replies with the JDE login screen but the ACE ignores it?

    Try by enabling persistence rebalance in an http parameter-map.
    Also your rewrite rule is wrong, you've been mistaken regarding the role of the Host field I guess. What you try to configure in your config is a URL rewrite but it's not supported by the ACE.

  • Changing Database Oracle Reports Connection.

    Hi Fellows.
    I would like to know if it is possible to Change Oracle Reports Connection (Ver2.5) after the end user fill in the Parameter Form. I have about 21 agencies with a Database in each one and the end user have to choose the agency what he wants to query. Send some ideas to see what can i do.
    Thanks for your Help!
    P.D. I had reading Oracle Reports help and I had found something about but did not work (CONNECT DB scott/tiger@inventory).

    Don't know how to do that, but I have a suggestion (not a very good one, i agree). You can use lexical parameters to achieve this.
    You may have all of your Report client connecting to the same "dummy" database. In this DB you'll create database links for all other agencies (databases).
    In the parameter form, you create a DB_LINK parameter listing all available agencies (DB Links).
    In your report query, you'll use a lexical parameter. I'd look something like that:
    select bla bla bla
    from TABLE_NAME@'&DB_LINK'
    As I said, it's not a very good idea, but I don't know an alternative either. If you already have lots of reports, you'll have to alter each one. I don't know if DB Links are a feasible solution for your environment. Don't know if you have the time for that...
    Regards,
    Marcos

Maybe you are looking for