Doubts concerning External Connection Pool

A few questions:
1. How can I set up an external connection pool with toplink? or in another words, assuming that I have successfully configured a connection pool (and a datasource) on my weblogic app-server, how do I configure Toplink to use the same?
2. I am trying to achieve the above (refer point 1), by defining my custom connector (by extending TOPLink.Public.Sessions.DefaultConnector). The custom connector provides connections using the dataSource.getConnection(). Now, the question is
- Where will the pooling happen in this case? i.e. Will Toplink use its own connection pool (populate its own connection pool with container managed data source), and issue connections (container managed) from there or will it make use of the container managed pooling (and ask for connections from the container managed pool, as and when required)? The subtle difference being, weblogic will not be able to validate a connection before issue in the former case.
3. This question is similar to point 2, but talks in terms of a practical example. Assuming that if I am using the custom connector successfully in my code, then if I pull out the network cord and reconnect again, I expect the container to provide me with a valid connection (as weblogic can be configured to perform a validity check on a connection before issuing). I am getting a 'connection reset by peer' error in my application (indicating that either the container fails to provide a valid connection, or toplink does not use the container managed pool effectively). I guess, Toplink still uses its own pool but this time it is pooling container managed dataSources. Since the connections are issued from Toplink and not container, here is no validation/reconnection happening for the connection, before issue. Please comment if I am thinking in the right direction or not. If not, how you can explain the above failure?
4. My aim is to utilise the container's connection pool, and Toplink's ability to perform the rest of the things (including transactions). Is that possible?

Vikas,
TopLink can easily be configured to use the external connection pool of an server. This can be accomplished with API but more commonly using the sessions.xml configuration file for the SessionManager. In the product we ship examples for WLS that make use of data sources configured in the server. The portion of the sessions.XML file in question is:
          <login>
               <user-name>weblogic</user-name>
               <password>weblogic</password>
               <datasource>java:comp/env/jdbc/ejbJTSDataSource</datasource>
               <non-jts-datasource>java:comp/env/jdbc/ejbNonJTSDataSource</non-jts-datasource>
               <uses-external-transaction-controller>true</uses-external-transaction-controller>
               <uses-external-connection-pool>true</uses-external-connection-pool>
          </login>
          <external-transaction-controller-class>oracle.toplink.jts.wls.WebLogicJTSExternalTransactionController</external-transaction-controller-class>
This sets TopLink up with both data source access to the JTA and non-JTA connection pools. The full example also includes a domain where the data source is configured.
When TopLink is using the connection pool of the server (external connection pooling) it will not pool its own connections. TopLink will request a connection from the pool each time one is required and release it back when done. This leaves the server responsible for the number of connections available and also for supporting database re-connection.
Doug

Similar Messages

  • External Connection Pool - No Available Connections

    I am using Toplink 9.0.4 in an application deployed on WebLogic 7. Toplink is configured to use an external connection pool.
    Under heavy load we sometimes exhaust the connection pool. When this occurs we start to get failures when trying to acquire connections.
    It appears that when Toplink tries to obtain a connection from the pool and none are available the attempt immediately fails with an exception. What we would prefer to happen is for the thread to block and wait for a connection to become available.
    Do you know of any way to produce this behavior? Is there a way to configure Toplink so this occurs?
    Alternatively is there a practical way to produce this behavior by implementing logic in a ServerSession exception handler? We have implemented an exception handler that handles dropped and stale database connections, but I'm not sure if this is the appropriate place to handle a failure retrieving a connection from the external pool.
    Any suggestions are appreciated.

    Well I have tried but I am unable to write an effective exception handler that can recover from an exception retrieving a connection from an external pool. I wrote the following handler and attached it to the ServerSession.
         public Object handleException(RuntimeException exception) throws DatabaseException{
              if(exception instanceof DatabaseException){
                   DatabaseException dbex = (DatabaseException)exception;
                   String exceptionMessage = dbex.getMessage();
                   if(exceptionMessage != null && exceptionMessage.indexOf("No available connections in pool") >= 0){
                        try{
                             Thread.sleep(5000);                    
                        }catch(InterruptedException e){}
                        oracle.toplink.publicinterface.Session session = null;
                        session = serverSession.acquireClientSession();
                        dbex.setSession(session);
                        if(session != null){
                             DatabaseQuery query = dbex.getQuery();
                             if(query != null){
                                  return session.executeQuery(query);
                             }else{
                                  return null;
                        throw exception;
                   }else{
                        throw exception;
              }else{
                   throw exception;
    It works sometimes but other times I get strange errors when executing the query. I know the mappings are good, the queries succeed under normal circumstances. The following error is commmon:
    Exception Description: The parameter name [UNIQUE_ID] in the query's selection criteria does not match any parameter name defined in the query.
    The other problem I have is the recursive nature of the exception handling. If calling ServerSession.acquireClientSession() in the exception handler causes an exception, I end up in another exception handler. It's not clear which instance should execute and return the query in this case.
    Any suggestions or examples of exception handlers for this situation are appreciated.

  • Problem to call a procedure while using External connection pooling in TopL

    HI all,
    I have implemented external connection pooling in TopLink with JBoss 4.0.3SP1 and it is working fine. But after the connection pooling I am getting error while executing stored procedure with TopLink on Sybase. This is the error I am getting......
    Stored procedure 'P_InsReleaseToManufact' may be run only in unchained transaction mode. The 'SET CHAINED OFF' command will cause the current session to use unchained transaction mode.
    I got one solution to this problem as to set a tag in sybase-ds.xml file(which is used in JBoss to enable connection pooling) ..............
    <connection-property name="SQLINITSTRING">set chained off</connection-property>
    but still it is not working.
    Can some one please tell me about the solution.

    Try
    session.getLogin().handleTransactionsManuallyForSybaseJConnect();

  • Connection Pool and Database Sessions

    Hi,
    Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?
    Thanks,
    Vinod

    Hi,
    Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?Hi Vinod,
    Yes, TopLink allows you to use the app server's connection pooling and transaction services. Chapter 2 of the Oracle9iAS TopLink Foundation Library Guide provides details as do the TopLink examples. The easiest way to set this up is by using the sessions.xml file. The sample XML below is from the file <toplink903>\examples\ias\examples\ejb\sessionbean\sessions.xml. Here we are adding the datasource defined in OC4J and specifying that we are using the OC4J transaction controller also.
    <login>
    <user-name>sa</user-name>
    <password></password>
    <datasource>java:comp/env/jdbc/ejbJTSDataSource</datasource>
    <uses-external-transaction-controller>true</uses-external-transaction-controller>
    <uses-external-connection-pool>true</uses-external-connection-pool>
    </login>
    <external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
    When using this approach you need to change your TopLink code slightly in the EJB methods:
    a. Acquire the ACTIVE unit of work from the server
    session (again, see the EmployeeSessionEJB code
    example) with something like:
    UnitOfWork uow = clientSession.getActiveUnitOfWork();
    b. Calls to uow.commit() can be ommitted or commented out
    because the EJB will handle this. Note that of course
    the methods you create in the EJB that are using this
    approach must have TX Required (default).
    Hope this helps.
    Pete

  • Listener EA2: database connection pool and connection revalidation

    Hi all,
    As one can expect from early adopter release there could be some bugs but I can't find any references in forum to my situation:
    * My 11g XE database and listener are starting as windows services when server boots operating system (Windows Server 2003 R2).
    * I configured my web server (unsupported Jetty 9.0.0.M1) to start as windows service when operating system starts.
    * Apex Listener 2.0.0.268.17.05 configured to connect with XE using JDBC thin driver with default settings (initial pool size 3, max statements 10, min connections 1, max connections 10, inactivity timeout 1800, abandoned connection timeout 900)
    * Because web server starts a bit faster than Oracle database when apex connects first time it gets "ORA-12528, TNS:listener: all appropriate instances are blocking new connections" (could be that database still starting but already registered service with listener)
    * From listener.log file I can see that all further connections made from Apex listener succeeds
    * When I try to open any apex page with browser I am getting 404 error and apex listener logs error (*time is 2 days after system startup*):
    2012-11-30 3:56:02 PM oracle.dbtools.common.config.db.DatabaseConfig badConfiguration
    SEVERE: The pool named: apex is not correctly configured, error: Listener refused the connection with the following error:
    ORA-12528, TNS:listener: all appropriate instances are blocking new connections
    ConnectionPoolException [error=BAD_CONFIGURATION]
         at oracle.dbtools.common.jdbc.ConnectionPoolException.badConfiguration(ConnectionPoolException.java:62)
         at oracle.dbtools.common.config.db.DatabaseConfig.badConfiguration(DatabaseConfig.java:146)
         at oracle.dbtools.common.config.db.DatabaseConfig.createPool(DatabaseConfig.java:168)
         at oracle.dbtools.common.config.db.DatabaseConfig.getConnection(DatabaseConfig.java:68)
         at oracle.dbtools.common.jdbc.ora.OraPrincipal.connection(OraPrincipal.java:25)
         at oracle.dbtools.apex.ModApexContext.getConnection(ModApexContext.java:320)
         at oracle.dbtools.apex.Procedure.getProcedure(Procedure.java:166)
         at oracle.dbtools.apex.OWA.validateProcedure(OWA.java:384)
         at oracle.dbtools.apex.security.Security.isValidRequest(Security.java:171)
         at oracle.dbtools.apex.ModApex.validateRequest(ModApex.java:233)
         at oracle.dbtools.apex.ModApex.doGet(ModApex.java:79)
         at oracle.dbtools.apex.ModApex.service(ModApex.java:263)
         at oracle.dbtools.rt.web.HttpEndpointBase.modApex(HttpEndpointBase.java:288)
         at oracle.dbtools.rt.web.HttpEndpointBase.service(HttpEndpointBase.java:127)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
         at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:665)
         <... Jetty web server stack ...>
         at java.lang.Thread.run(Unknown Source)
    2012-11-30 3:56:02 PM oracle.dbtools.rt.web.HttpEndpointBase modApex
    * Oracle listener log for same time (no errors here):
    30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1078)) * establish * xe * 0
    30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1079)) * establish * xe * 0
    30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1080)) * establish * xe * 0
    30-NOV-2012 15:56:01 * (CONNECT_DATA=(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))(SERVICE_NAME=xe)(CID=(PROGRAM=JDBC Thin Client)(HOST=__jdbc__)(USER=SYSTEM))) * (ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1081)) * establish * xe * 0
    * For some reason apex listener keeps first connection status and won't try to establish new connection if first attempt finished with ORA-12528
    * The same scenario is valid when at time of web server start oracle database/listener is not available - even if database and listener starts and apex successfully establishes further connections all apex pages gets 404 error
    * If I restart web server windows service (while oracle db and listener still running) browser opens apex pages without errors and apex listener does not log any errors
    * I know that I can avoid this error delaying start of web server windows service but it would be nice to have production release 2.x without such bugs

    Hi,
    Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?Hi Vinod,
    Yes, TopLink allows you to use the app server's connection pooling and transaction services. Chapter 2 of the Oracle9iAS TopLink Foundation Library Guide provides details as do the TopLink examples. The easiest way to set this up is by using the sessions.xml file. The sample XML below is from the file <toplink903>\examples\ias\examples\ejb\sessionbean\sessions.xml. Here we are adding the datasource defined in OC4J and specifying that we are using the OC4J transaction controller also.
    <login>
    <user-name>sa</user-name>
    <password></password>
    <datasource>java:comp/env/jdbc/ejbJTSDataSource</datasource>
    <uses-external-transaction-controller>true</uses-external-transaction-controller>
    <uses-external-connection-pool>true</uses-external-connection-pool>
    </login>
    <external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
    When using this approach you need to change your TopLink code slightly in the EJB methods:
    a. Acquire the ACTIVE unit of work from the server
    session (again, see the EmployeeSessionEJB code
    example) with something like:
    UnitOfWork uow = clientSession.getActiveUnitOfWork();
    b. Calls to uow.commit() can be ommitted or commented out
    because the EJB will handle this. Note that of course
    the methods you create in the EJB that are using this
    approach must have TX Required (default).
    Hope this helps.
    Pete

  • Connection pooling problem in TopLink with JBoss4.0.3

    Hi All
    I am using JBoss4.0.3SP1 with TopLink-10g(9.0.4.5) and Sybase as database. I am implementing connection pooling of JBoss with Sybase. I have done all the changes in JBoss mapping files.
    Now to enable connection pooling in TopLink I have set the <uses-external-connection-pooling> attribute in sessions.xml file to true and I have added <datasource> attribute corresponding to the datasource defined in JBoss. It is working fine but when I delete the username, password...etc attribute from the sessions.xml then I am not able to get the session from datasource.
    Can anyone tell me what to do or where I am making mistake? Any help on this will be appreciated

    I tried that code also but the project object that I am getting is null which is in this line
    DatabaseLogin login = (DatabaseLogin)mySession.getProject().getLogin();
    mySession is an object of oracle.toplink.sessions.Session interface but when I call this method then it returns me a null object of Project class, so I am getting NullPointerException error. I tried to do this stuff by many ways but I am always getting the NullPointereException in setLogin() method of Session. This is the stackTrace of the error.....
    java.lang.NullPointerException
    at oracle.toplink.publicinterface.Session.setLogin(Session.java:2871)
    at com.test.TestCon.executeQurey(TestCon.java:91)
    at org.apache.jsp.Test_jsp._jspService(org.apache.jsp.Test_jsp:55)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Unknown Source)
    Can you please tell me where I am wrong or any other way to do fix this problem.

  • Oracle Application server connection pool and database links

    I am using Oracle application server 10g with connection pools, the db used by the application connects to another oracle db using a database link. My question is when the application starts it creates 10 connections, does it also create x amount of database links as well?

    Hi,
    Is there any way to use the connection pool or Datasource while connecting to database?If I am using a stateless sesssion bean and using a Data Access layer which just creates a database session to write the persistence toplink objects how I can make use of application server connection pool?Hi Vinod,
    Yes, TopLink allows you to use the app server's connection pooling and transaction services. Chapter 2 of the Oracle9iAS TopLink Foundation Library Guide provides details as do the TopLink examples. The easiest way to set this up is by using the sessions.xml file. The sample XML below is from the file <toplink903>\examples\ias\examples\ejb\sessionbean\sessions.xml. Here we are adding the datasource defined in OC4J and specifying that we are using the OC4J transaction controller also.
    <login>
    <user-name>sa</user-name>
    <password></password>
    <datasource>java:comp/env/jdbc/ejbJTSDataSource</datasource>
    <uses-external-transaction-controller>true</uses-external-transaction-controller>
    <uses-external-connection-pool>true</uses-external-connection-pool>
    </login>
    <external-transaction-controller-class>oracle.toplink.jts.oracle9i.Oracle9iJTSExternalTransactionController</external-transaction-controller-class>
    When using this approach you need to change your TopLink code slightly in the EJB methods:
    a. Acquire the ACTIVE unit of work from the server
    session (again, see the EmployeeSessionEJB code
    example) with something like:
    UnitOfWork uow = clientSession.getActiveUnitOfWork();
    b. Calls to uow.commit() can be ommitted or commented out
    because the EJB will handle this. Note that of course
    the methods you create in the EJB that are using this
    approach must have TX Required (default).
    Hope this helps.
    Pete

  • PI' RFC  Connection pool  doubt.

    Hi PI exports:
    i have a doubt about  pi' RFC  Connection pool ,pi RFC receive channel can set the conn pool size ,but when start the rfc receiver channel ,is there always only one Connection  pool ,or there is only one Connection  pool  instance?
      thinks
    Edited by: kevin liang on Oct 19, 2009 6:45 AM

    Hi,
      Connection poolins size means how many number of connection you want to make open to send data to ECC, We can define maximum number of connection in Receiver RFC Adapter,Go to additional parameters section and define Max Number of connection give the number there,thats it.Internally it works as Connection poolin mechanism.
    Regards,
    Raj

  • Doubt in connection pooling

    Hi,
    I have a doubt in connection pooling.
    I we create 100 connections in a connection pool, when do the connections created or assigned? Is it during the login time or during there is a request for the connection?
    Please explain the doubt in detail.
    Thanks

    It depends on connection pool implementation.
    Anyway you should not worry about it.
    In general some connections created right away and some created after if required. You should be able to configure your pool.

  • Some doubts in using resource-ref,connection pool n Data-source

    Hi all ,
    I need little bit clarification in the following points.
    1) Does the connection pool which is created can be displayed in JNDI Tree???
    I am seeing only DataSOurce in the JNDI Tree Only.
    2)In case of Bean Managed Persistance, in ejb-jar.xml,
    I had given the following info.
    <resource-ref>
             <res-ref-name>ramukkDataSource</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
         </resource-ref>Does the <res-ref-name> refers to Datasource Name??
    In weblogic-ejb-jar.xml
    <reference-descriptor>
           <resource-description>
              <res-ref-name>ramukkDataSource</res-ref-name>
              <jndi-name>ramukkpool</jndi-name>
           </resource-description>
         </reference-descriptor>Here <jndi-name> refers to connection pool as per weblogic bible book.
    If so when i deployed my ejb into the server iam getting Datasource cant be found.
    If i had given like the following,
    In ejb-jar.xml
    <resource-ref>
              <res-ref-name>jdbc/ramuJndi</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
         </resource-ref> In weblogic-ejb-jar.xml
         <reference-descriptor>
              <resource-description>
               <res-ref-name>jdbc/ramuJndi</res-ref-name>
               <jndi-name>jdbc/ramuJndi</jndi-name>
           </resource-description>
        </reference-descriptor>Then only my ejb code is successfully deploying doing some work which is as per xpectation.
    Can any body tell why I have to give the same name for <res-ref-name> n <jndi-name>??
    I am working on this problem from last one week. Still not found the solution.
    Connection Pool Creation
    GENERAL::
    Name : ramukkpool
    url : jdbc:mysql://localhost:3306/test
    Driver Classname: com.mysql.jdbc.Driver
    Properties :
    user = root
    Password = XXX
    create
    TARGETS::
    i had shifted myServer from left side to right side n clicked >>Apply
    (Techncially can we say this as deploying the connection pool into server ???????????
    If not how to deploy the connection pool into server??)
    I did not get any errors in the console.
    Now i am creating a datasource
    CONFIGURATION:
    Name : ramukkDataSource
    JNDIName: jdbc/ramuJndi(Does we have to follow this convention only?? i.e JNDIName should start with jdbc/ only)
    PoolName: ramukkpool
    create
    TARGETS::
    I had shifed myServer from left to right n >>Apply.
    Now also i did not get any errors in the console.Thanx(in advance),
    ramu

    I have read the documentation.
    I changed my class to oracle.jdbc.pool.OracleConnectionCacheImpl from
    oracle.jdbc.pool.OracleConnectionPoolDataSource
    I observed in the EM that the Open JDBC Connections and Total JDBC Connections are the same. When I used oracle.jdbc.pool.OracleConnectionPoolDataSource my Total JDBC Connections was increasing and Open JDBC Connections remains 0.
    My question still remains unanswered, could some kindly help.
    Q? I have defined a data source in JDeveloper using
    oracle.jdbc.pool.OracleConnectionCacheImpl
    In my java bean I am using the code pasted below to make a connection to database.
    Can some one tell whether I am using the correct method of connection pooling mechanism or do I need to make some changes? This application uses JSP and used by lots of people which hits database very frequently.
    Any help is highly appreciable.
    Thanks in advance.
    *******Code to make connection*********
    private javax.naming.InitialContext context = null;
    private javax.sql.DataSource jdbcURL = null;
    private static final String url = "jdbc/ProdCoreDS";
    public boolean openConnection()
    try
        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    context = new javax.naming.InitialContext();
    jdbcURL = (javax.sql.DataSource)context.lookup(url);
    con =  jdbcURL.getConnection();
    return true;
      catch(Exception e)
           System.out.println("Error in the Connection  "+e);
        e.printStackTrace();
                 return false;
         }}

  • Connect to WebLogic connection pool externally?

    Running Oracle 8i (thin driver) & WL 5.1
    I can connect directly to the db using
    public class TestDB
         String dbURL = "jdbc:oracle:thin:@p1900:1521:p1900";
         String dbDriver = "oracle.jdbc.driver.OracleDriver";
         public boolean connect()
         Class.forName(this.getDbDriver());
         System.err.println("Driver load ok");
         dbConn = DriverManager.getConnection(this.getDbURL());
         System.err.println("Connected ok");
    return true;
    but is it possible to connect to WL connection pool from a program
    thats not within the WL server (i.e no problem from a servlet)?
    This is from weblogic.properties -
    weblogic.jdbc.connectionPool.hazardouswaste=\
    url=jdbc:oracle:thin:@p1900:1521:p1900,\
    driver=oracle.jdbc.driver.OracleDriver,\
    initialCapacity=1,\
    maxCapacity=1,\
    capacityIncrement=1,\
    props=user=tact_dev;password=tact_dev,\
    allow=guest
    How can I get a conection from the hazardouswaste connection pool?
    I've tried this but it
    String dbURL = "jdbc:weblogic:pool:hazardouswaste";
    String dbDriver = "weblogic.jdbc.pool.Driver";
    I keep getting this -
    return getDbURL - jdbc:weblogic:pool:hazardouswaste
    java.sql.SQLException: Pool connect failed: null
    at weblogic.jdbcbase.pool.Driver.connect(Driver.java:184)
    at java.sql.DriverManager.getConnection(DriverManager.java:517)
    at java.sql.DriverManager.getConnection(DriverManager.java:199)
    at jsp_servlet.TestDB.connect(TestDB.java:62)
    at jsp_servlet.Test.main(Test.java:16)
    Any ideas
    harry

    [att1.html]

  • Connection pooling in multithreaded app results in occasional "Closed Statement" exc"

    Hi there,
    I'm writing a CORBA servant, which amongst all calls in a stored procedure. I'm using connection pooling (just by example) from multiple threads and use grabbed connection to prepare an SP statement, execute it, and close both statement and connection (to return it to the pool). My stress tests run fine for the most part but once in a while throws out "Closed Statement" exception when trying to excecute the prepared statement.
    The reference platform is Solaris7, thin driver 8.1.6 for Java2, jdk 1.2.2, Oracle 8.1.5 (backend), ORBacus 3.3 (external application orb).
    Do you guys have any "multithreaded" statements as far as pooling concerned? Let me know if you need code, schema, anything at all. Any recommendations are greatly appreciated too, like "don't use prepared statements, don't use pooling from multiple threads, download upgrade, etc". Thanks ahead.
    Yours,
    -Evgeni

    Dear Oracle JDBC Development Team,
    First of all, I object to your comment "Please don't spread wrong information.". I do not spread wrong information. That is why I wrote in my previous email, "it isn't thread safe (as far as my tests have shown)". My statement is thus conditional on MY testing. I recognise the fact that I could be wrong. Hence, the conditional clause.
    As for the claim that OracleConnectionCacheImpl is thread safe - well, since it is your software then all I can do is believe you. However, I repeatedly get a java.util.EmptyStackException from calls to oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection() when running my test WITHOUT using the "synchronized" clause on the OracleConnectionCacheImpl object.
    This, of course, could be due to the fact that my test is faulty. I don't know. I can't see the fault in any case. If you can help me with this then I would be more than grateful.
    In any case, when I use the "synchronized" statement on OracleConnectionCacheImpl then this error disappears in a multithreaded environment.
    Another interesting thing my test showed was that the JDBC driver seems to hang under heavy workload. Again, I could be WRONG. It could be my test that causes the problem, however, it is very hard to pinpoint the problem.
    I would really appreciate help with this, if you have time, as we are using OracleConnectionCacheImpl in a major Internet billing system. If you wish to help then please send me an email to [email protected] (or [email protected]) and I will then send you my source code for the test.
    In any case, I will word my messages with even more care in future!
    regards,
    Alexander Day
    null

  • Connection pool fail

    Hi, guys
    I use instant client 11.2.0.3.0 OCCI to create a connection pool, when create a connection from pool, it supposed using the existing connection, but the code created anohter new connection to database, any ideas? appreciate your help.
    client side is running on Windows 7 32 bit, Database server is 10.2.05 on Solaris 10, development tool is MS VS 2010
    here is the code:
    Environment *env;
    Connection *conn;
    Statement *stmt;
    string sqlStmt;
    env = Environment::createEnvironment (Environment::THREADED_MUTEXED);
    const string poolUserName = "scott";
    const string poolPassword = "1234";
    const string connectString = "192.168.0.70/orcl";
    const string username = "scott";
    const string passWord = "1234";
    unsigned int maxConn =5;
    unsigned int minConn = 2;
    unsigned int incrConn = 1;
    ConnectionPool *connPool = env->createConnectionPool(poolUserName, poolPassword, connectString, minConn, maxConn, incrConn);
    try{
    if (connPool)
    cout << "SUCCESS - createConnectionPool" << endl;
    else
    cout << "FAILURE - createConnectionPool" << endl;
    conn = connPool->createConnection (username, passWord); _// after this code, connection increase to 3 from 2._*
    if (conn)
    cout << "SUCCESS - createConnection" << endl;
    else
    cout << "FAILURE - createConnection" << endl;
    }catch(SQLException ex)
    cout<<"Exception thrown for createConnectionPool"<<endl;
    cout<<"Error number: "<< ex.getErrorCode() << endl;
    cout<<ex.getMessage() << endl;
    ......

    Hi Nicolas,
    Have you tried to turn on testOnReserve setting of the coneection pool?
    Regards,
    "Nicolas Devos" <[email protected]> wrote in message
    news:3c5fa916$[email protected]..
    >
    Hi,
    I am using weblogic 6.1 and oracle 8.1.6, and experiences
    problems with connections pools and database crash.
    When the database server crashes during an EJB transactions,
    the connection used by that transaction seems to be lost and
    is never rebuilt when the database server restarts, therefore
    the number of connections within the pool shrinks thoroughly
    if I have several connections used while the database crashes
    or is shutdown for maintenance.
    If this db crash takes time to recover, all connections
    are destroyed and the pool become unusable.
    As soon as all connections have been 'destroyed' I have
    the following exception:
    'connection pool - none available' when trying to get
    a connection.
    When I restart the database server, the pool does not rebuilt
    itself.
    (I am using a test table to test the presence of the database
    with a frequency set to 60s)
    I did the same operation without EJB transactions and the pool
    could rebuilt itself after the database has been restarted.
    I had that problem with weblogic 6.0 already and in the
    release notes of 6.0_sp2, 2 issues are fixed concerning
    the pool fail-over: 044223 and 041793.
    I would like to know if these issues are fixed in 6.1 as well,
    and if they are related to my problem (Their description is
    quite short).
    Thank you
    Nicolas

  • Connection Pool establishment problem

    Hi Experts,
    we have one application with JCo mechanism. For this application,
    we are using one properties file, which holds ABAP connection information. From this connection information(sapconn.props), we created connection pool and fetching data from the back end. Now my requirement is, instead of this properties file, we want to use one SLD, from this i would like to fetch connection information and establish a connection pool. How can we implement this one...?
    Is there any API to read the ABAP connection informaation from visual admin (JCo RFC provider) ?
    Thanks
    maha

    Your question has been answered in this [thread|connection establishment doubt;.
    Please read the [rules|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement], in particular - do not cross post.
    -- Vladimir

  • Connection Pooling and JSP Custom Tag Library - is code (inside) the best way/correc?

    Hi, can anyone advise as to whether my tag library code (based
    on Apache Jakarta Project) will actually achieve connection
    pooling functionality across my entire JSP based application? I
    am slightly concerned that my OracleConnectionCacheImpl object
    may exist multiple times, hence rendering my conection pooling
    attempt useless.
    package com.solved.tag.dbtags.connection;
    import java.io.IOException;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.servlet.jsp.tagext.TagSupport;
    import javax.servlet.jsp.JspTagException;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import oracle.jdbc.pool.OracleConnectionCacheImpl;
    * <p>JSP tag connection, used to get a
    * java.sql.Connection object.</p>
    * <p>JSP Tag Lib Descriptor
    * <pre>
    * &lt;name>connection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.ConnectionTag&lt;/t
    agclass>
    * &lt;bodycontent>JSP&lt;/bodycontent>
    &lt;teiclass>com.solved.tag.dbtags.connection.ConnectionTEI&lt;/t
    eiclass>
    * &lt;info>Opens a connection based on a jndiName.&lt;/info>
    * &lt;attribute>
    * &lt;name>id&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/attribute>
    * </pre>
    * @author Matt Shannon
    public class ConnectionTag extends TagSupport {
    static private OracleConnectionCacheImpl cache = null;
    public int doStartTag() throws JspTagException {
    try {
    Connection conn = null;
    if (cache == null) {
    try {
    InitialContext ic = new InitialContext();
    DataSource ds = (DataSource) ic.lookup
    ("jdbc/pool/OracleCache");
    cache = (OracleConnectionCacheImpl)ds;
    catch (NamingException ne) {
    throw new JspTagException(ne.toString());
    conn = cache.getConnection();
    pageContext.setAttribute(getId(),conn);
    catch (SQLException e) {
    throw new JspTagException(e.toString());
    return EVAL_BODY_INCLUDE;
    package com.solved.tag.dbtags.connection;
    import java.sql.Connection;
    import java.sql.SQLException;
    import javax.servlet.jsp.tagext.TagSupport;
    * <p>JSP tag closeconnection, used to close the
    * specified java.sql.Connection.<p>
    * <p>JSP Tag Lib Descriptor
    * <pre>
    * &lt;name>closeConnection&lt;/name>
    &lt;tagclass>com.solved.tag.dbtags.connection.CloseConnectionTag&
    lt;/tagclass>
    * &lt;bodycontent>empty&lt;/bodycontent>
    * &lt;info>Close the specified connection. The "conn"
    attribute is the name of a
    * connection object in the page context.&lt;/info>
    * &lt;attribute>
    * &lt;name>conn&lt;/name>
    * &lt;required>true&lt;/required>
    * &lt;rtexprvalue>false&lt;/rtexprvalue>
    * &lt;/attribute>
    * </pre>
    * @author Matt Shannon
    * @see ConnectionTag
    public class CloseConnectionTag extends TagSupport {
    private String _connId = null;
    * The "conn" attribute is the name of a
    * page context object containing a
    * java.sql.Connection.
    * @param connectionId
    * attribute name of the java.sql.Connection to
    close.
    * @see ConnectionTag
    public void setConn(String connectionId) {
    _connId = connectionId;
    public int doStartTag() {
    try {
    Connection conn = (Connection)pageContext.getAttribute
    (_connId);
    conn.close();
    } catch (SQLException e) {
    // failing to close a connection is not fatal
    e.printStackTrace();
    return EVAL_BODY_INCLUDE;
    public void release() {
    _connId = null;
    package com.solved.tag.dbtags.connection;
    import javax.servlet.jsp.tagext.TagData;
    import javax.servlet.jsp.tagext.TagExtraInfo;
    import javax.servlet.jsp.tagext.VariableInfo;
    * TagExtraInfo for the connection tag. This
    * TagExtraInfo specifies that the ConnectionTag
    * assigns a java.sql.Connection object to the
    * "id" attribute at the end tag.
    * @author Matt Shannon
    * @see ConnectionTag
    public class ConnectionTEI extends TagExtraInfo {
    public final VariableInfo[] getVariableInfo(TagData data)
    return new VariableInfo[]
    new VariableInfo(
    data.getAttributeString("id"),
    "java.sql.Connection",
    true,
    VariableInfo.AT_END
    data-sources.xml:
    <?xml version="1.0"?>
    <!DOCTYPE data-sources PUBLIC "Orion data-
    sources" "http://xmlns.oracle.com/ias/dtds/data-sources.dtd">
    <data-sources>
    <data-source
    class="oracle.jdbc.pool.OracleConnectionCacheImpl"
    name="jdbc/pool/OracleCache"
    location="jdbc/pool/OracleCache"
    url="jdbc:oracle:thin:@oracle1:1521:pdev"
    >
    <property name="maxLimit" value="15" />
    <property name="cacheScheme" value="2" />
    <property name="user" value="console" />
    <property name="password" value="console" />
    <description>
    This DataSource is using an Oracle-native DataSource Class so as
    to allow Oracle Specific extensions.
    A getConnection() call on this DataSource will return
    oracle.jdbc.driver.OracleConnection.
    The connection returned is a logical connection.
    The caching scheme in place is Fixed Wait. Refer below to
    possible values.
    Dynamic 1
    Fixed Wait 2
    Fixed Return Null 3
    </description>
    </data-source>
    </data-sources>
    many thanks,
    Matt.

    Hi. Show me your pool definition.
    Joe
    Ramamurthy wrote:
    I am using the jsp custom tag library from BEA called sqltags.tld which came with Weblogic 5.1. Currently I am using Weblogic6.1 sp2 on Solaris.
    I have created a Connection Pool for Sybase database using the driver com.sybase.jdbc.SybDriver.
    When I created jsp page to connect to the connection pool using sqltags custom tag library, I am getting the error
    "javax.servlet.jsp.JspException: Failed to write body content
    at weblogic.taglib.sql.ConnectionTag.doAfterBody(ConnectionTag.java:43)
    at jsp_servlet.__hubwcdata._jspService(__sampletest.java:1014)"
    After this message, whenever I try to access the same jsp page I am getting the message
    "javax.servlet.jsp.JspException: Failed to load JDBC driver: weblogic.jdbc.pool.D
    river
    at weblogic.taglib.sql.ConnectionTag.doStartTag(ConnectionTag.java:34)
    at jsp_servlet.__hubwcdata._jspService(__sampletest.java:205)".
    Can you please help me the reason why this problem is happening and how to fix this ?
    This problem doexn't happen consistently. This occurs once in a while.
    I tried to increase Login delay Seconds parameter in the Connection Pool to 15 sec. It didn't help me much.
    Thanks for your help !!!
    Ram

Maybe you are looking for

  • Apple support page "generic error" message when I want to open a case

    the case is 2 folds, I been trying to register my ipad 2, which I bought at the same time and location togther with macbook pro 13", the macbook product registration went throuh fine, but for the iPad I got the message that the product is already reg

  • Why can't I sync my ipod after update

    After doing the latest update, my ipod, iPad and iPhone is no longer recognised in iTunes. None of the devices I have are connecting or showing in connected devices box, it is all greyed out. I have run the device test on iTunes but it says there is

  • My iphone says I need 5.8 date and I've deleted everything and it won't update to IOS8 why????

    I have an iphone 4s, and I've been trying to update my iphone to IOS8 and it keeps saying there is not data storage available, they need 5.8, and I have deleted everything and have more than enough for the update, why is it not working?? what can I d

  • Why wont my ds connect to airport express

    my nintendo ds will only connect to the airport express when the security is off. it will start to connect with a WEP but drops the signal immediately. i dont know what might be set up wrong but i have tried from scratch numerous times. anyone out th

  • Going from lightroom to photoshop

    Somehow, I lost communication between lightroom and photoshop, and when in lightroom, I go to edit> in photoshop, it is grayed out. Is ther a simple fix, or do I have to reload photoshop? I already reloaded lightroom.