Recognizing alternate connection pool

hi..
Currently, If a connection pool fails due to a TNS failure, application instance also fails, it has lost connectivity.
But I need, my application to recognize an alternate connection pool, such that if transactions time out on one connection, application would recognize that the primary pool is not responding and retry the transactions on a secondary data connection pool via the alternate DB instance.
If I get the solution for this, it will be appreciable
Thanks in advance
Suresh

Hi. Look at our documentation on multipools.
Joe
Suresh Kumar wrote:
hi..
Currently, If a connection pool fails due to a TNS failure, application instance also fails, it has lost connectivity.
But I need, my application to recognize an alternate connection pool, such that if transactions time out on one connection, application would recognize that the primary pool is not responding and retry the transactions on a secondary data connection pool via the alternate DB instance.
If I get the solution for this, it will be appreciable
Thanks in advance
Suresh

Similar Messages

  • How to create connection pooling in Tomcat 5.0

    present i am developing one web site in that i am using tomcat 5.0
    i am trying to establish connection pooling in tomcat,i am facing some problems..
    tomcat throws the following exception ie.,
    cannot create JDBC Driver class for connect URL null.
    my code lik this
    i configured the web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app>
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>sqlserver</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    my server.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Server>
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
    <Resource auth="Container" name="sqlserver" type="javax.sql.DataSource"/>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sudha</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>sudha</value>
    </parameter>
    </ResourceParams>
    <ResourceParams name="sqlserver">
    <parameter>
    <name>url</name>
    <value>jdbc:odbc:SQL</value>
    </parameter>
    <parameter>
    <name>validationQuery</name>
    <value>select * from employee</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>4</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>8</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>kpi</value>
    </parameter>
    <parameter>
    <name>factory</name>
    <value>org.apache.naming.factory.DbcpDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>kpi</value>
    </parameter>
    </ResourceParams>
    </GlobalNamingResources>
    <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
    <Host appBase="webapps" name="localhost">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
    </Host>
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
    </Service>
    </Server>
    and i studied the the tomcat documentation in that tomcat mentioned
    The configuration properties for Tomcat's standard data source resource factory (org.apache.naming.factory.DbcpDataSourceFactory) are as follows:
    driverClassName - Fully qualified Java class name of the JDBC driver to be used.
    maxActive - The maximum number of active instances that can be allocated from this pool at the same time.
    maxIdle - The maximum number of connections that can sit idle in this pool at the same time.
    maxWait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.
    password - Database password to be passed to our JDBC driver.
    url - Connection URL to be passed to our JDBC driver. (For backwards compatibility, the property driverName is also recognized.)
    user - Database username to be passed to our JDBC driver.
    validationQuery - SQL query that can be used by the pool to validate connections before they are returned to the application. If specified, this query MUST be an SQL SELECT statement that returns at least one row.
    how to configure server.xml file
    and how to get the org.apache.naming.factory.DbcpDataSourceFactory
    please help me...this module is very very urgen to me..

    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

  • How to create Connection pool in Tomcat 5

    present i am developing one web site in that i am using tomcat 5.
    i am trying to establish connection pooling in tomcat,i am facing some problems..
    tomcat throws the following exception ie.,
    cannot create JDBC Driver class for connect URL null.
    my code lik this
    i configured the web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app>
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>sqlserver</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    my server.xml
    <?xml version='1.0' encoding='utf-8'?>
    <Server>
    <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
    <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
    <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
    <Resource auth="Container" name="sqlserver" type="javax.sql.DataSource"/>
    <ResourceParams name="UserDatabase">
    <parameter>
    <name>factory</name>
    <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>sudha</value>
    </parameter>
    <parameter>
    <name>pathname</name>
    <value>conf/tomcat-users.xml</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>sudha</value>
    </parameter>
    </ResourceParams>
    <ResourceParams name="sqlserver">
    <parameter>
    <name>url</name>
    <value>jdbc:odbc:SQL</value>
    </parameter>
    <parameter>
    <name>validationQuery</name>
    <value>select * from employee</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>4</value>
    </parameter>
    <parameter>
    <name>maxActive</name>
    <value>8</value>
    </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>sun.jdbc.odbc.JdbcOdbcDriver</value>
    </parameter>
    <parameter>
    <name>maxWait</name>
    <value>5000</value>
    </parameter>
    <parameter>
    <name>username</name>
    <value>kpi</value>
    </parameter>
    <parameter>
    <name>factory</name>
    <value>org.apache.naming.factory.DbcpDataSourceFactory</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>kpi</value>
    </parameter>
    </ResourceParams>
    </GlobalNamingResources>
    <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" port="8080" redirectPort="8443" maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3" protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler" redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
    <Host appBase="webapps" name="localhost">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_log." suffix=".txt" timestamp="true"/>
    </Host>
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="catalina_log." suffix=".txt" timestamp="true"/>
    <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
    </Service>
    </Server>
    and i studied the the tomcat documentation in that tomcat mentioned
    The configuration properties for Tomcat's standard data source resource factory (org.apache.naming.factory.DbcpDataSourceFactory) are as follows:
    driverClassName - Fully qualified Java class name of the JDBC driver to be used.
    maxActive - The maximum number of active instances that can be allocated from this pool at the same time.
    maxIdle - The maximum number of connections that can sit idle in this pool at the same time.
    maxWait - The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.
    password - Database password to be passed to our JDBC driver.
    url - Connection URL to be passed to our JDBC driver. (For backwards compatibility, the property driverName is also recognized.)
    user - Database username to be passed to our JDBC driver.
    validationQuery - SQL query that can be used by the pool to validate connections before they are returned to the application. If specified, this query MUST be an SQL SELECT statement that returns at least one row.
    how to configure server.xml file
    and how to get the org.apache.naming.factory.DbcpDataSourceFactory
    please help me...this module is very very urgen to me..

    I spent many hours when i first implemented connection pooling trying to put it together. The information is scattered and the config has changed slightly from 5.0 to 5.5 etc. This is how I got it working in 5.5.17:
    * server.xml seems to be a wrong place for the pool configuration if you consider it to be an application specific thing. It might be a better idea to put it into C:\tomcat55\conf\Catalina\localhost\ConfigFileForYourWeapp.xml as follows:
    <Context path="/ClientLink" docBase="C:\eclipseWorkspace\PortfolioUI3\WebRoot">
          <Resource name="jdbc/testportfolios" auth="Container"
                         type="javax.sql.DataSource"
                         factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
                         username="****" password="******"
                         driverClassName="com.mysql.jdbc.Driver"
                         url="jdbc:mysql://192.168.0.101:3306/testportfolios?user=***********&password=***********&useUnicode=true&characterSet=swedish"
                         maxWait="10000" maxActive="30" maxIdle="10" removeAbandoned="true"
                         removeAbandonedTimeout="60" logAbandoned="true" testWhileIdle="true"
                         minEvictableIdleTimeMillis="4000"
                         timeBetweenEvictionRunsMillis="60000" validationQuery="SELECT '1'" />
          </Context>* Then add the following snippet into web.xml in your webapp directory:
    <resource-ref>
                    <description>Database pool defined in ClientLink.xml</description>
                    <res-ref-name>jdbc/testportfolios</res-ref-name>
                    <res-type>javax.sql.DataSource</res-type>
                    <res-auth>Container</res-auth>
               </resource-ref>* Next put the jdbc-driver jar in a place where tomcat can find it. That is common\lib. Note that the shared/lib does not work.
    * Get connections in java as follows:
                    try {
                         Context initCtx = new InitialContext();
                         DataSource ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/testportfolios");
                         this.connection = ds.getConnection();
                    } catch (NamingException e) {
                         throw new RuntimeException("Java naming exception when getting connection from tomcat pool: " + e.getMessage());
                    }I hope that this helps you to save the time I lost figuring this out!
    Message was edited by:
    Tomppu

  • RFC_FAILURE affects Connection Pool

    Using VB.NET (2003) with .Net Connector 2.0.
    An intermittent problem causes a RFC Call to fail, and an exception is raised in the .NET code. The Exception message is:
         See RFC trace file or SAP system log for more details
    The Trace file shows:
    ERROR file opened at 20051115 131423 GMT Standard
         T, SAP-REL 640,0,78 RFC-VER 3 759904 MT-SL
    <b>T:2844 Could not send rfc container 0x130
    T:2844 <* RfcCall [1] : returns 1:RFC_FAILURE
    T:2844 <* RfcCallReceive [1] : returns 1:RFC_FAILURE
    >TS> Tue Nov 15 13:14:24 2005
    T:2844 <* RfcCleanupContext [1] : returns
              18:RFC_INVALID_HANDLE
    T:2844 <* RfcCleanupContext [1] : returns
              18:RFC_INVALID_HANDLE</b>
    This error adversely affects the Connection Pool – as calls to other RFCs are now prone to similar intermittent errors…
    Is there any way to prevent the problem causing problems with Connection Pool ?
    Is there any way of removing a “faulty” connection from the pool ? (NB Close and Dispose on the connection does not help)

    The application is a Windows service - so I don't want to lose any connections. I assume that closing the connection (and not returning it) will affect the number of available connections in the pool(?).
    I'm using async. RFC call, and the problem is detected in the callback function when the EndRFCCall is performed.
    Original code:
    Public Sub Execute_RFC(ByVal parameters as string())
    ' Assign SAP Connection to RFC Proxy
    sapRFCProxy.Connection = SAPConnectionPool.GetConnectionFromPool(<i>ConnectString</i>)
    Call the SAP RFC - Asynchronously
    arAsyncResult = m_sapRFCProxy.BeginRFCCall( params..., AddressOf RFC_CallBack, objAsyncState)
    End Sub
    Private Sub RFC_CallBack(ByVal ar As IAsyncResult)
    Try
        ' Retrieve the SAP RFC Response...
        Call sapRFCProxy.EndRFCCall(ar, <i>param1, param2, etc...</i>)
    Catch ex As Exception
        ' Log the Error...
    End Try
    ' Return the Connection
    Call SAPConnections.ReturnConnection(sapRFCProxy.Connection)
    End Sub
    I have changed the code as suggest so that the connection is closed, disposed but <u>not</u> returned. This cleared the RFC_INVALID_HANDLE errors, but the main problem of a corrupted connection persists.
    Diagnostics produced by the amended code:
    <u>Trace File (Info):</u>
    2005-11-16 11:55:46Z     Warning: RfcCleanupContext failed. Closing connection
    <u>dev_RFC.trc</u>
    ERROR file opened at 20051116 115546 GMT Standard T, SAP-REL 640,0,78 RFC-VER 3 759904 MT-SL
    T:3068 ======> CPIC-CALL: 'CMSEND'
    ERROR       program state check for conversation 99610798
    TIME        Wed Nov 16 11:55:46 2005
    RELEASE     640
    COMPONENT   CPIC (TCP/IP)
    VERSION     3
    RC          471
    MODULE      r3cpic.c
    LINE        2576
    DETAIL      called function STSEND in state state=BUFFER_DATA2
    COUNTER     1
    T:3068 <* RfcCall [20] : returns 1:RFC_FAILURE
    T:3068 <* RfcCallReceive [20] : returns 1:RFC_FAILURE
    T:3068 <* RfcCleanupContext [20] : returns 1:RFC_FAILURE
    Even with the change to the code, a call to a reliable RFC will now fail <u>intermittently</u> with:
    T:2876 Could not send rfc container 0x130
    T:2876 <* RfcCall [24] : returns 1:RFC_FAILURE
    T:2876 <* RfcCallReceive [24] : returns 1:RFC_FAILURE
    Thanks

  • Connection pool / db failure

    WLS6.0 sp2 / Win2k
    Oracle 8.1.7 / Solaris 8
    problem is if DB fails, the connection pool fails, and will not restart. If I run a java weblogic.Admin EXISTS_POOL command, it says the pool doesnt exist.
    If i run a RESET_POOL, using the system user password, it comes back with:
    Exception in thread "main" javax.naming.AuthenticationException. Root exception is java.lang.Securi
    tyException: Authentication for user guest denied in realm weblogic
    <<no stack trace available>>
    I have test on reserved set (and dual as the table).
    Anyone shed any light on what could be going wrong, because right now, every time the DB fails, we have to restart the **&$"&^ server.... (and that takes around 20mins for all the apps to init)
    tks
    will

    Hi Will,
    When you bring up the server, if the database is down, your connection pools
    will not come up if you have an initial capacity greater than 0. This is a
    known issue and the workaround for this is to set the initial capacity to
    zero so the pool comes up even when the database is down, then make sure you
    set the capacity increment to the value that you like your initial capacity
    to be and have the TestConnectionOnReserve to true.
    hth
    sree
    "Will" <[email protected]> wrote in message
    news:3d13111f$[email protected]..
    WLS6.0 sp2 / Win2k
    Oracle 8.1.7 / Solaris 8
    problem is if DB fails, the connection pool fails, and will not restart.If I run a java weblogic.Admin EXISTS_POOL command, it says the pool doesnt
    exist.
    If i run a RESET_POOL, using the system user password, it comes back with:
    Exception in thread "main" javax.naming.AuthenticationException. Rootexception is java.lang.Securi
    tyException: Authentication for user guest denied in realm weblogic
    <<no stack trace available>>
    I have test on reserved set (and dual as the table).
    Anyone shed any light on what could be going wrong, because right now,every time the DB fails, we have to restart the **&$"&^ server.... (and that
    takes around 20mins for all the apps to init)
    >
    tks
    will

  • RFC_ERROR_SYSTEM_FAILURE: Time limit exceeded. Connection Pool - JCO api

    Hi Everyone
    My Connection  Pool parameters JCO api.
    client=300
    user=SISGERAL_RFC
    passwd=******
    ashost=14.29.3.120
    sysnr=00
    size=10
    I have these parameters on my Connection Pool and sometimes appear these wrongs in my application:
    1.
    2006-01-07 13:20:37,414 ERROR com.tel.webapp.framework.SAPDataSource - ##### Time limit exceeded. LOCALIZED MESSAGE = Time limit exceeded. KEY = RFC_ERROR_SYSTEM_FAILURE GROUP = 104 TOSTRING = com.sap.mw.jco.JCO$Exception: (104) RFC_ERROR_SYSTEM_FAILURE: Time limit exceeded.
    2.
    2006-01-07 14:01:31,007 ERROR com.tel.webapp.framework.SapPoolConnectionManager - Timeout
    I’d like to know if is happening.
    Are there something wrong with my connection pool?
    What can be happening?
    Thanks

    Raghu,
    Thanks for your response.
    Yes, the pool connections are in place according to the sAP note mentioned above.
    Regards,
    Faisal

  • Connection Pool Failure: "No suitable driver"

    Hi,
    Upon server startup, I get the following result:
    <Nov 7, 2001 4:18:32 PM CST> <Error> <JDBC> <Cannot startup connection pool "ora
    cleTrufflePool" No suitable driver>
    I assumed it was a path problem, but in the startWebLogic.cmd script I've set the PATH and CLASSPATH variables to the same as in a separate command window that can successfully dbping the Oracle db.
    One thing I completely don't understand is what the URL value should be for the pool, and I can't see a pattern in the examples and docs I've found on this. Here are my pool settings, at any rate:
    Name: oracleTrufflePool
    URL: myOracleServerName
    Driver Classname: weblogic.jdbc.oci.Driver
    Properties:
    user=user
    password=password
    server=myOracleServerName
    ACLName: user
    Password: password
    As you can see, I also don't understand whether the Oracle user name and password must be duplicated in the Properties section, or should they really only be listed in the ACLName and Password fields (in the Server Console UI)?
    TIA,
    Steve

    Hi. The issue is that the URL you give is not the URL the driver (weblogic.jdbc.oci.Driver)
    wants. The URL should be "jdbc:webLogic:oci". The properties user, password and server
    will be passed to the driver for conenction attempts. The ACL is for who gets to use the
    pool, and the other password entry is only if you need the DBMS password to be encrypted
    in the XML. If so, set that password value, and don't have it in the driver properties.
    Joe
    Steve Clark wrote:
    >
    Hi,
    Upon server startup, I get the following result:
    <Nov 7, 2001 4:18:32 PM CST> <Error> <JDBC> <Cannot startup connection pool "ora
    cleTrufflePool" No suitable driver>
    I assumed it was a path problem, but in the startWebLogic.cmd script I've set the PATH and CLASSPATH variables to the same as in a separate command window that can successfully dbping the Oracle db.
    One thing I completely don't understand is what the URL value should be for the pool, and I can't see a pattern in the examples and docs I've found on this. Here are my pool settings, at any rate:
    Name: oracleTrufflePool
    URL: myOracleServerName
    Driver Classname: weblogic.jdbc.oci.Driver
    Properties:
    user=user
    password=password
    server=myOracleServerName
    ACLName: user
    Password: password
    As you can see, I also don't understand whether the Oracle user name and password must be duplicated in the Properties section, or should they really only be listed in the ACLName and Password fields (in the Server Console UI)?
    TIA,
    Steve

  • Connection Pool Failure

    Hello. I'm using wls 5.1 and Oracle 8i and an unable to make a connection pool. I keep getting the following with the message below. Where and how do I change my path?
    weblogic.common.ResourceException: weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: System.loadLibrary threw java.lang.UnsatisfiedLinkError
    'no weblogicoci36 in java.library.path'.
    at weblogic.jdbcbase.oci.Driver.connect(Driver.java:116)

    Hi,
    You need to ensure that the ORACLE_HOME is set and PATH has
    %ORACLE_HOME%\bin;%ORACLE_HOME%\lib;%WL_HOME%\bin\oci816_8 (check verison of
    database) in the server startup script.
    hth
    sree
    "Purvi" <porgie_76@> wrote in message news:3c6306f9$[email protected]..
    Hello. I'm using wls 5.1 and Oracle 8i and an unable to make a connection
    pool. I keep getting the following with the message below. Where and how do
    I change my path?
    weblogic.common.ResourceException: weblogic.common.ResourceException:
    Could not create pool connection. The DBMS driver exception was:
    java.sql.SQLException: System.loadLibrary threw
    java.lang.UnsatisfiedLinkError
    'no weblogicoci36 in java.library.path'.
    at weblogic.jdbcbase.oci.Driver.connect(Driver.java:116)

  • Easy JNDI + Connection Pool Question

    This is an easy question:
    Once I get the object represented by my connection pool from the
    Weblogic JNDI tree, how do I get a connection from the returned object
    of type weblogic.common.internal.ResourceAllocator?
    I keep getting ClassCastExceptions. I have tried
    ConnectionPoolDataSource, Connection, and DataSource.
    String conPool = "weblogic.jdbc.connectionPool.demoPool";
    try {
    Object obj = ctx.lookup(conPool);
    msg(DEBUG,"FROM LOOKUP" + obj.getClass().getName());
    //DataSource ds = (DataSource)ctx.lookup(conPool);
    //con = ds.getConnection();
    } catch (NameNotFoundException e) {
    // binding does not exist
    msg(ERROR,"BINDING DOES NOT EXIST",e);
    } catch (NamingException e) {
    // a failure occurred
    msg(ERROR,"NAMING FAILURE OCCURED",e);
    } catch (Exception e) {
    msg(ERROR,"SOME RANDOM ERROR",e);
    Thanks,
    -Jacob

    "Jacob Meushaw" wrote in message
    Once I get the object represented by my connection pool from the
    Weblogic JNDI tree, how do I get a connection from the returned object
    of type weblogic.common.internal.ResourceAllocator?
    I keep getting ClassCastExceptions.
    DataSource ds = (DataSource)ctx.lookup(conPool);I think, you must use narrow operation:
    Object reference = ctx.lookup(conPool);
    DataSource ds =
    (DataSource) PortableRemoteObject.narrow (ds,DataSource.class);
    I haven't got time to check it, but I hope that works.
    Wojtek

  • Create A Connection Pool In the ServletContextListener

    The Specification says that we should create the connection pool in the ServletContextListener. I have the code for creating a connection pool (see below). How do I create it in the ServletContextListener?
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    public class DBConnection
       public static Connection getDBConnection() throws SQLException
          Connection conn = null;
          try
             InitialContext ctx = new InitialContext();
             DataSource ds = ( DataSource ) ctx.lookup( "java:comp/env/jdbc/MySQLDB" );
             try
                conn = ds.getConnection();
             catch( SQLException e )
                System.out.println( "Open connection failure: " + e.getMessage() );
          catch( NamingException nEx )
             nEx.printStackTrace();
          return conn;

    I use the connection pool feature provide by the server I use. Is this what I should do? Please confirm.
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.sql.DataSource;
    import javax.servlet.*;
    public class CreateResources implements javax.servlet.ServletContextListener
         public void contextInitialized(ServletContextEvent sce)
              public static Connection getDBConnection() throws SQLException
                   Connection conn = null;
                   try
                        InitialContext ctx = new InitialContext();
                        DataSource ds = ( DataSource ) ctx.lookup( "java:comp/env/jdbc/MySQLDB" );
                        try
                             conn = ds.getConnection();
                        catch( SQLException e )
                             System.out.println( "Open connection failure: " + e.getMessage() );
                  catch( NamingException nEx )
                        nEx.printStackTrace();
                  return conn;
         public void contextDestroyed(ServletCotnextEvent sce)
    }

  • Issue JDBC connection pool with Glassfish 3.1.2.2 and Oracle XE 11gR2

    Hello,
    I am experiencing an issue with pinging a JDBC connection Pool.
    I installed the following without any warnings or errors:
    Operating System: Oracle Enterprise Linux 5
    Oracle XE 11gR2 (11.2.0.2.0) database
    Glassfish 3.1.2.2
    I will refer to the steps I did after the installations
    1) In the .profile file of the OS I add the following:
    JRE_HOME=/usr/java/jre1.6.0_31; export JRE_HOME
    JAVA_HOME=/usr/java/jdk1.6.0_31; export JAVA_HOME
    GLASSFISH_DIR=/u01/glassfish3
    GLASSFISH_HOME=/u01/glassfish3/glassfish
    DERBY_HOME=$GLASSFISH_DIR/javadb
    OPEN_MQ_HOME=$GLASSFISH_DIR/mq
    PATH=:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HOME/bin:$GLASSFISH_HOME/bin:$DERBY_HOME/bin:$OPEN_MQ_HOME/bin
    export GLASSFISH_HOME
    export DERBY_HOME
    export OPEN_MQ_HOME
    export PATH
    LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/xe/lib; export LD_LIBRARY_PATH
    . /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh
    2) I copied the ojdbc6.jar to the $GLASSFISH_HOME/domains/domain1/lib
    3) I login to the Glassfish admin console and created a new JDBC Connection Pool.
    Pool Name: ds_orasys
    Resource Type: javax.sql.DataSource
    Datasource Classname: oracle.jdbc.pool.OracleDataSource
    User: [myschema]
    Password: [myschema password]
    URL: jdbc:oracle:thin:@localhost:1521:xe
    When I ping the connection pool I get the following message in the server log:
    [#|2012-10-23T12:14:37.069+0300|WARNING|glassfish3.1.2|javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service|_ThreadID=22;_ThreadName=Thread-2;|RAR8054: Exception while creating an unpooled [test] connection for pool [ ds_orasys ], Connection could not be allocated because: Invalid Oracle URL specified|#]
    [#|2012-10-23T12:14:37.071+0300|SEVERE|glassfish3.1.2|org.glassfish.admingui|_ThreadID=19;_ThreadName=Thread-2;|RestResponse.getResponse() gives FAILURE. endpoint = 'http://212.205.62.217:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=ds_orasys}'|#]
    I tried to use different jar files. I used ojdbc6dms.jar and ojdbc14.jar.
    I also copied the jar files in the $GLASSFISH_HOME/domains/domain1/lib/ext directory as some people suggested. Still no luck. I keep getting the same error messages in the server.log
    Can anybody help me out or point me to the right direction.
    Thank you in advance

    The error is in the URL. It was in front of my eyes and I couldn't see the error. I skipped the ':' before the '@' when I created the pool. It is working fine now.

  • Configuring JCo3 Connection Pool with single sign on on non SAP Java server

    Hi Everyone,
    i have configured a connection pool on JBoss as per JCo3 Documentation and is working great.
    Now I need help to configure this connection pool with single sign on so that RFc on SAP ECC systems are executed using end users credential rather than using single user name password used to configure JCo connection pool.
    On SAP Java stack I am sure its possible within Java WebDynpro    and i assume using JCA resource adapter. But what if we don't want to use SAP Java App server.
    Any help will be appreciated.
    Thanks,
    Divyakumar Jain

    Eason, 你好!
    I have exactly the same problem.  Did you find a solution to this problem?  If so, please let me know!

  • JDBC Connection pool recovery after DB server restart

    I am finding that Kodo is throwing the following exception after I restart
    my database server (mysql). I am doing the database server restart while my
    application server is idle, so it is not during a transaction.
    Communication link failure: java.net.SocketException [code=0;state=08S01]
    NestedThrowables:
    com.solarmetric.kodo.impl.jdbc.sql.SQLExceptionWrapper:
    This is presumably due to the JDBC connection pooling. Is there a
    configuration setting that allows Kodo to detect such failures and reconnect
    to the database server without exposing this problem to the application
    code? For example, WebLogic Server's JDBC connection pool has a setting that
    enables testing a connection and recovering from such failures before
    allocating it from the pool.
    Ben

    This is presumably due to the JDBC connection pooling. Is there a
    configuration setting that allows Kodo to detect such failures and reconnect
    to the database server without exposing this problem to the application
    code?Not right now. You can log an enhancement request with our bug database:
    http://bugzilla.solarmetric.com/

  • RCA Connection Pool idle Time-Out takes no effect !

    My question description goes here.
    According to JCA specification, I developed my 'ManagedConnectionImpl' class from the interface 'ManagedConnection'. I realize the 'destroy()' function to send out logout request to the EIS.
    Then I deployed the connector in Sun Java System Application Server, I noticed there are two parameters in Connection Pool part, they are:
    1. Idle Timeout. It said it's the maximum time that a connection can remain idle in the pool. I assume the connection will be removed after the specific time expired and before it's removed it will call the recallable function, 'destroy()', in my concrete class, 'ManagedConnectionImpl'.
    2. Pool Resize Quantity. it said it's number of connections to be removed when pool idle time expired.
    I am weird about it. I think EIS had itself session control strategy, if the specific session time-out expired, it will invalidate this session. So I think we will set 'Idle Timeout' in application server to be shorter than the EIS session time-out. If the 'Idle Timeout' in application server expired, it should remove all connections inside otherwise maybe the connection with invalid session will exist! (the background knowledge is our system will return back soap fault when it meets invalid session, so the invalid connections will not be removed by switching on your configuration item, 'On Any Failure')
    So I set "inital and minimum pool size" to 8, "maximum pool size" to 32 and "Pool Resize Quantity" to 32. (I expect AS to remove all when pool idle time expired)
    After deploying, I send out requests at the first round and wait for the time expired but I can't see the desired logout requests from pool automatically even one. Firstly I guess if my recallable function definition is wrong but when I shut down the Application Server, the desired logout requests are sent out from pool automatically. So I think my recallable function definition is workable.
    What's your comments on it?
    P.S.
    I am using Sun Java System Application Server 8.1.
    Thanks in advance!
    BRs
    /Leo

    I have had following test to ensure I sent out notification to listener.
    [#|2005-08-23T16:14:25.061+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    It's in managed env!|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    enter matchManagedConnections() !|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    try to find a matching and existing one, reuse it!|#]
    [#|2005-08-23T16:14:25.062+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    Found a matching and existing one, reuse it!|#]
    [#|2005-08-23T16:14:25.495+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    tearDown() is called, the application-level connection is released!|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    enter calling close() of managed connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    Start calling close() of managed connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    start to notify the listener the completeness of connection.|#]
    [#|2005-08-23T16:14:25.496+0800|INFO|sun-appserver-pe8.1_01|javax.enterprise.system.stream.out|_ThreadID=12;|
    notify the listener the completeness of connection successfully.|#]
    Whether it's related with the initial and minimum number parameter? Although I found it will not be created during AS start-up and will be created at the first request.
    Whether it shall be kept to meet the minimum requirement? I have failed to set it to 0.

  • Serious connection pool problem on Tomcat

    Hi,
    We are deploying our JSF creator-made app onto Tomcat 1.5. We set up our JNDI datasource on Tomcat (using the i-net driver ).
    Initially the pages load ok but after a short period of time we are getting these errors:
    Initialization Failure: javax.faces.FacesException: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot get a connection, pool exhaustedWe believe that somehow the Creator-generated code is NOT freeing up connections in the connection pool.
    We think that when the afterRenderResponse() methods in the beans call rowset.close() this is NOT returning the connections to the pool. Can someone, hopefully a Sun Engineer confirm that the rowset.close() code in afterRenderResponse() returns the connection behind the rowset to the connection pool.
    Could this be a driver issue? We are using the i-net driver not the DataDirect one, but this should implement the full API.
    This is a very serious problem for us.
    regards,
    john

    do you have any example code you could post? I have a Spring/JSC tutorial on this forum. Just search for Spring and you should find it. It you need something more, I'll try to give you some help...time provided.
    am i
    right in thinking that you use the forms designer to
    lay out your pages and just put your own stuff in the
    bean constructor?Close...but not everything goes in the constructor.
    >
    One thing that may have caused a problem is we have
    just noticed that in one of our most commonly hit
    pages this line:
    dataTable1Model.setDataCacheKey("com.sun.datacache.my_
    page.my_rowset");
    featured the WRONG "my_page" jsp page but the correct
    rowset name "my_rowset". The page DID load correctly
    and run correctly, though. Could this cause problems
    with connection pooling? Anyone?I wouldn't think so, but it depends on how Creator builds the code.

Maybe you are looking for

  • I have adobe Photoshop element 6

    I can't open my adobe photoshop element, the error message says: This application has requested the Runtime to terminate it in an unusual way. Please contact the application support team for more information. I need help for this question. Dan

  • Problem with BEFW11S4v4

    I have a wireless b BEFW11S4 v4 with the latest firmware, and im having a problem where the DHCP, the wireless, or the entire router stops working.  the only way to fix this is to power cycle the router. I've noticed that this tends to happen when i 

  • Illustrator color picker position on dual monitor mac

    o/ Is there a way to control where the color picker appears in illustrator cs5.5 on mac os lion 10.7.3? I have a mac pro with a monitor and a cintiq, the monitor is the "active" monitor, it has to be for my use, and the cintiq is the secondary monito

  • Report - GR for which Excise Capture & Posting are pending

    Hi, The scenario for Goods Receipts for Excisable Materials is as follows: 1. GR done by stores 2, Excise Capture done by Excise Clerks 3. Excise Posting done by Excise Supervisor Is there any report through which we can monitor the following: a. GR

  • Missing Pix in Library

    Macbook Tiger Iphoto 6 When I look at my Pictures folder...Iphoto Library...Artwork....all my pix are there to view. When I open Iphoto and look at the pix, my Library structure stops at 'Artwork', with no sub-folders and no artwork pix nor any of th