Connection Pooling Questions

Hi there,
I was previously using the jferner/node-oracle module with the "generic-pool" (https://github.com/coopernurse/node-pool) module for connection pooling. 
I'm trying out a setup with connection pooling with node-oracledb and have a few questions:
* If an execute call fails with a connection i've retrieved from the pool, and I want to destroy that connection and remove it from the pool, how do I do that?  Is it done implicitly for me? 
* Is there any way to validate a connection before it's used?  Or again, is this done implicitly?  Is there a way to toggle it on and off for perf tuning?
* Is there any way to tune how frequently Oracle checks for idle connections?  (In generic-pool this was called reapIntervalMillis)
* Is there any way to turn on any logging of how the connection pool behaves for development debugging?  I just want to make sure my setup is behaving as I think it should be.
I'm making some good headway on getting the module working and it wasn't too difficult a conversion from node-oracle, either, that's good!
-Matt

You should release() bad connections to the pool so the pool can replace them.
Validating connections is generally not worth it: between validation & use there could be a failure, so your executions need to handle errors anyway.  Why reduce scalability and performance by doing an extra "round trip" for validation? Also you can use FAN which can proactively clean up idle sessions in the session pool that are affected by the DB instance disappearing (due to network glitches etc).
The client-side pool is handled by Oracle session pooling, so the algorithms are opaque.

Similar Messages

  • 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

  • Connection Pool Questions

    I have a JSP/Servlet application I am developing. I would like to create one OraclePooledConnection for the application. I then have a set of repository classes(CommonRepository, EmployeeRepository, etc) that access the database and create JavaBeans for the JSP's to use. I would like each of these repository classes to access the single OraclePooledConnection.
    Currently I have a DataSourceWrapper class that extends the OraclePooledConnection class. This DataSourceWrapper class is a singleton class, so I am assured of only one class and in the Init() function I call super(url, user, pwd). (Source is below.) It seems to work, but I am not positive in is creating a Connection Pool. How could I test this? If it is not how would I do this?
    TIA,
    Gerald
    public class DataSourceWrapper extends OraclePooledConnection
    * field containing the driver used to connect to the database
    private static String driver = null;
    * field containing the url address of the database
    private static String url = null;
    * field containing the user name used to connect to the database
    private static String user = null;
    * field containing the password used to connect to the database
    private static String pw = null;
    * handle to the current Repository instance
    private static DataSourceWrapper instance;
    * handle used to get a database connection
    private PooledConnection ds = null;
    * Private Class Constructor.
    * <P>
    * Only one instance of this class is ever wanted, which means this class is a
    * singleton class. To accomplish this, the Class Constructor scope is private
    * to this class only. A static function <code>getInstance()</code> is used to
    * create the initial instance of this class and passes the handle all other
    * classes that need to access it.
    public DataSourceWrapper() throws SQLException{
    //Initialize the DataSource
    super(url,user,pw);
    * Returns a handle to this singleton Repository object.
    * <P>
    * If first time the method has been called it creates a Repository object by
    * calling the Class Constructor. If this is not the first call to the method
    * it returns the stored reference to this object
    * @return static reference to this singleton Repository
    * @throws RepositoryException thrown if error occurs during initialization
    protected static DataSourceWrapper getInstance() throws SQLException {
    if (instance == null)
    instance = new DataSourceWrapper();
    return instance;
    public void finalize() {
    try {
    ds.close();
    } catch (Exception e) {} //Application is closing who cares
    * Sets the the database connection information
    * @param newDriver driver used to connect to database
    * @param newUrl url address used to connect to database
    * @param newUser user id used to connect to database
    * @param newPassword password used to connect to database
    public static void setConnectInfo(
    String newDriver,
    String newUrl,
    String newUser,
    String newPassword) {
    driver = newDriver;
    url = newUrl;
    user = newUser;
    pw = newPassword;
    }

    I have a JSP/Servlet application I am developing. I would like to create one OraclePooledConnection for the application. I then have a set of repository classes(CommonRepository, EmployeeRepository, etc) that access the database and create JavaBeans for the JSP's to use. I would like each of these repository classes to access the single OraclePooledConnection.
    Currently I have a DataSourceWrapper class that extends the OraclePooledConnection class. This DataSourceWrapper class is a singleton class, so I am assured of only one class and in the Init() function I call super(url, user, pwd). (Source is below.) It seems to work, but I am not positive in is creating a Connection Pool. How could I test this? If it is not how would I do this?
    TIA,
    Gerald
    public class DataSourceWrapper extends OraclePooledConnection
    * field containing the driver used to connect to the database
    private static String driver = null;
    * field containing the url address of the database
    private static String url = null;
    * field containing the user name used to connect to the database
    private static String user = null;
    * field containing the password used to connect to the database
    private static String pw = null;
    * handle to the current Repository instance
    private static DataSourceWrapper instance;
    * handle used to get a database connection
    private PooledConnection ds = null;
    * Private Class Constructor.
    * <P>
    * Only one instance of this class is ever wanted, which means this class is a
    * singleton class. To accomplish this, the Class Constructor scope is private
    * to this class only. A static function <code>getInstance()</code> is used to
    * create the initial instance of this class and passes the handle all other
    * classes that need to access it.
    public DataSourceWrapper() throws SQLException{
    //Initialize the DataSource
    super(url,user,pw);
    * Returns a handle to this singleton Repository object.
    * <P>
    * If first time the method has been called it creates a Repository object by
    * calling the Class Constructor. If this is not the first call to the method
    * it returns the stored reference to this object
    * @return static reference to this singleton Repository
    * @throws RepositoryException thrown if error occurs during initialization
    protected static DataSourceWrapper getInstance() throws SQLException {
    if (instance == null)
    instance = new DataSourceWrapper();
    return instance;
    public void finalize() {
    try {
    ds.close();
    } catch (Exception e) {} //Application is closing who cares
    * Sets the the database connection information
    * @param newDriver driver used to connect to database
    * @param newUrl url address used to connect to database
    * @param newUser user id used to connect to database
    * @param newPassword password used to connect to database
    public static void setConnectInfo(
    String newDriver,
    String newUrl,
    String newUser,
    String newPassword) {
    driver = newDriver;
    url = newUrl;
    user = newUser;
    pw = newPassword;
    }

  • Web service connection pooling question

    I have a web service running on a Win2003 machine. I am accessing it using a
    client implemented in an EJB. The server is running Weblogic 8.1 SP2. It
    works, but there are three things I would like to implement
    1) Connection timeouts. i.e. If the web service client attempts to connect
    and does not get any response back, such as when you try to access a machine
    at an address that does not exist. Note: I am already using
    setProperty("weblogic.webservice.rpc.timeoutsecs", "2") and
    bindingInfo.setTimeout(2) to set a read timeout (and this works).
    2) Connection pooling. The web service endpoint is reached using SSL, and
    establishing an SSL connection is expensive in terms of CPU and network
    latency. Can I pool a certain number of connections, and then use them when
    I access the web service? This would be faster than creating a new
    connection each time. Currently, I have one line of code that invokes the
    method on my web service and stores the result in an object. Any ideas?
    3) Connection limiting. I want to limit the maximum number of simultaneous
    invocations of my web service by this particular WebLogic instance. Does
    WebLogic allow me to do this?
    Thanks in advance.

    I have used connection pooling in tomcat using a servlets init method to set up the pool, but I am not sure how I could incorporate something similar with my web service. Maybe I'm just confused as to if a webservice is created when it connected to or does it live at the endpoint untill the container shuts down??!!

  • JBO Parameters + Connection Pooling Question

    I know that it is possible to pass in BC4J configuration parameters (such as jbo.dofailover) to the JVM via the -D parameter. It is unclear to me, though, how those parameters are actually used because I can also configure each application module in my app differently. If parameters are passed using the -D parameter, does that override any individual application module configuration settings at run-time?
    It looks like every application module instance, at runtime, creates a JDBC connection into the database. How can I put a cap on that or limit the entire application to X number of connections? Currently, I'm using a JDBC URL and I'm seeing the following behavior:
    * 10 users all using 12 application modules = 120 JDBC connections into Oracle. Ouch.
    If I were to switch over to a JDBC DataSource using the WebLogic JDBC Connection Pool driver, will this effectively take over JDBC connection pooling for my application? In other words, if I set that datasource to a maximum of 50 simultaneous connections, will this truly limit the app to 50 connections or will the maximum possible be 50 connections * 12 application modules = 600?!?
    Thanks!

    I know that it is possible to pass in BC4J configuration parameters (such as jbo.dofailover) to the JVM via the -D
    parameter. It is unclear to me, though, how those parameters are actually used because I can also configure each
    application module in my app differently. If parameters are passed using the -D parameter, does that override any
    individual application module configuration settings at run-time? .
    The configuration settings take precedence over VM parameters. Tthe following thread also
    contains some discussion regarding BC4J parameter precedence:
    Re: using OLB, PLL etc., on 10gAS on AIX and 10G AS on windows =>Very Urgen
    It looks like every application module instance, at runtime, creates a JDBC connection into the database. How can
    I put a cap on that or limit the entire application to X number of connections? Currently, I'm using a JDBC URL and
    I'm seeing the following behavior:.
    * 10 users all using 12 application modules = 120 JDBC connections into Oracle. Ouch..
    If connecting with a JDBC URL then BC4J's connection pool will be used to acquire application modules. The max size
    of a connection pool may be defined with the parameter jbo.maxpoolsize. However, if the application has been
    architected to simultaneously use 12 root application modules per application request/session then BC4J will require
    12 JDBC connections per user. Specifying a maximum pool size will simply cause the other users to wait for
    connections resulting in high latency and/or wait timeouts. So, you should probably plan on configuring the connection
    pool size to meet your average application demands or consider using fewer AMs.
    Please also note that the BC4J connection pool parameters apply to a single pool instance. So, if each application
    user is connecting as a different DB user then the jbo.maxpoolsize will apply to each DB user's connection pool only.
    If I were to switch over to a JDBC DataSource using the WebLogic JDBC Connection Pool driver, will this effectively
    take over JDBC connection pooling for my application?.
    Yes.
    In other words, if I set that datasource to a maximum of 50 simultaneous connections, will this truly limit the app to
    50 connections or will the maximum possible be 50 connections * 12 application modules = 600?!?.
    Depends upon WebLogic's implementation. However, if you have 50 simultaneous application requests and if each
    request requires 12 simultaneous ApplicationModule(s) then you will require 600 ApplicationModule(s) and these 600
    ApplicationModule(s) will require 600 JDBC connections.
    Hope this helps.
    JR

  • Connection pools

    Hi,
    We are having around 25 tables from one data source. We have around 8 subject areas. My question is can we have as many connection pools as we can. I mean if I bring couple of subject areas in one connection pool and feel that if I bring in the third the physical layer joins would be confusing, can open another connection pool to bring in tabels for subject area 3,4 and continue. Do we have to have one connection pool for all subject area if they are coming from one source. Few tables are thier in almost all Subject areas. Is it advicable to use multiple connection pools from one source. Please advce.

    Thanks for your help Saichand. I was aware that we could do in BMM but physical I just came to know. Also I had to use one table for two diff subject areas. So i created an alias for of that table. I took this alias and created the physical joins, complex joins in BMM for a subjet area and it ran without errrors. When I went into presenation layer and tried to build a report it was erroring out saying table does not exist. It is looking for the alias table name and says no table found in DB. We cant keep the alias table also with the same name in Physical .. right? How do I resolve this alias table issue? this was the reason I asked about the connection pool question.

  • Connection pool utilization -  questions and problems.

    Hi,
    This is in context to JSP/Java/JPDK based web provider applcation. Appreciate it if anyone can add any input here -
    1)After adding dbPersonalization to my JSP portlets I noticed that the connections in my connection pool have maxed out. After the first few page renderings, it breaks. I am not sure if its an inherent problem in my design. But, I do know that it started happening soon after I add the dbPersonalization with all its required setups as specified. Could that be possible ? Besides the connectionmanager.xml file required by the dbPersonalization setup, I also have my own connection properties file where I specify the min and max connections in the pool for all my java classes/methods to make use of. Is there a chance that the connection pooling information from both the files are clashing each other ??
    2) On a related topic - I wanted to get some input on a design question. I have about 10 JSP Portlets on each of the four tabs of my Portal page, with each one instantiating one class (useBean) that contain methods to get data from the database. Now every single method of each of these classes, gets and puts a connection object from the pool.
    The question is if the frequency of getting a conn object in every method of every JSP portlet too expensive ? Would it be better to make use of one connection object common to all the methods in a class/JSP/portlet ?
    I had set the min to 6 and the max conns to 25 and it looks like very soon all 25 gets used, which wasnt happening before I added the dbPersonalization setup to my portlets. The dbPersonalizaiton is only for editDefaults though.
    regards
    -Ananth Makaram

    Ryan,
    as to your 7.2.1 problem: MANY people had that same issue and did revert to
    7.1.1 (I did the same after being unable to connect once I upgrade) So no
    worries - your AEBS is fine as it is working with 7.1.1
    For the second part, I am not a wifi guy, but check out the article on
    http://www.bbwexchange.com/pubs/2006/09/20/page1397-228167.asp
    maybe that will give you some idea about WiFi 2.0 and if you benefit from it!
    Joerg

  • Questions regarding Connection Pooling

    Hi
    i have some confusion regarding how connection pooling is implemented..i have been doing some digging in to this lately but the more i read the more confused i get. i have some doubts here, will any of the posters here kindly clear them
    a. Do i have to connect to my database via the DataSource method to take advantage of the connection pooling provided by my app server?..i have read conflicting information about this suggesting that Connection Pooling will not be provided to my app if i use DriverManager.getConnection()
    b. if i chose to use the DataSource method do i have to implement the ConnectionPoolDataSource interface to provide the connection pooling for my app?
    c. what is the best way to implement my own custom Connection pool?
    Thanx

    DriverManager.getConnection() literally creates, that is, builds a connection to the database using the values you previously supplied when you loaded the driver.
    A connection pool is an object that contains several already made connections to the database, and simply provides you with one of those existing connections. The confusion arises because a) the method name is frequently the same and b) the connection pool object calls the driver's getConnection() method to create several connections before lending any of them out.
    In other words:
    DriverManager.getConnection() builds a connection to the database.
    ConnectionPool.getConnection() fetches an existing connection.
    So, to answer your questions...
    A. This is correct. If you use DriverManager.getConnection(), you are indeed bypassing the Connection Pool entirely.
    B. I'm not familiar with DataSource specifically, but in general, a third party connection pool will either give you the interface (and you implement the details) or they will give you the class file containing the DataSource object. All you would have to do in the latter case is to import that file, then create a new instance of it using the new keyword ( DataSource foo = new DataSource(); ). I suspect DataSource is indeed the class file.
    C. Creating a connection pool is trivial and there are many examples of it - search on this forum or check out your favorite Java/JDBC programming book. Usually, the question "Should I use a connection pool and why?" is a more important question.

  • Questions on Connection Pooling

    I already read the documentations on data-sources.xml, but I still have questions. In the following data-sources.xml (for OC4J 9.0.3):
    <data-source
    class="com.evermind.sql.ConnectionDataSource"
    name="ccf"
    location="jdbc/ccf"
    xa-location="jdbc/xa/ccf"
    ejb-location="jdbc/ccfPool"
    url="jdbc:oracle:thin:@erb:1521:prod"
    connection-driver="oracle.jdbc.driver.OracleDriver"
    username="scott"
    password="tiger"
    max-connections="300"
    min-connections="5"
    max-connect-attempts="10"
    connection-retry-interval="1"
    inactivity-timeout="30"
    wait-timeout="30"
    />
    I know that if we want to use a connection pool, we should use "ejb-location" and it is the only one used for emulated data sources. I also know that both "location" and "xa-connection" are used for non-emulated data sources.
    Then my questions are:
    1) Does non-emulated data source mean that it can not used for connection pooling? In other words, both "location" and "xa-location" can not be used for connection pooling? The only one that can be used for connection pooling is "ejb-location"?
    2) How can I use a non-pooled connection? right now, I am using "location" for non-connnection pooling, is this the right way to do it? The documentation says that it will be deprecated in future release, then what should I use if I want a non-pooled connection? can I still use "ejb-location" by setting "min-connections" and "max-connections" to 1? This is assuming that we can NOT use "location" to get the data source.
    3) Putting the username and password in the data-sources.xml seems not be good from the security point of view. But, if I am using CMP, I must supply the username and password in the data-sources.xml. Is there another way around this?
    Thank you very much for the help in advance.
    Jingzhi

    Liu
    I may not answer all ur questions.But would like to share my experiences....
    3) U can set the username and password dynamically also...we use it in orion..so u should be able to use it in oc4j..as a matter of fact, we can set all the data-sources parameters dynamically(programmatically).
    1) I may not be correct 100 percent with this :but for pooling only ejb-location is used and for non pooling location is used.
    For non pooled connections also, use ejb-location and dont give any max and min connections..let it take the default values...
    I am not aware that Oracle is going to deprecate the location ..well it is good to hear this which will reduce some confusion..
    seems there is lot being raised on these topics..
    yugandhar

  • Tomcat 5.0.* global JNDI database connect pooling. complex config question

    Ok. I can't get global connection pooling to work in tomcat 5.0.24. (I am running windows xp pro)
    I am using MySQL (installed on the same machine) and I have succesfully worked through the tutorial titled "MySQL DBCP Example" found at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    This example does not demonstrate global connection pooling, however. I want to share a single connection pool across all my web applications. I don't want a different connection pool for each webapp.
    So I define the connection pool JDBC resource in the conf/server.xml file under the <GlobalNamingResources> element.
    Here is the entire <GlobalNamingResources> element lifted from conf/server.xml:
    (Please overlook some of the formatting mistakes due to the <code> tag interpreting the xml as java.)
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource name="UserDatabase"
                  auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved">
        </Resource>
        <Resource name="jdbc/MySQL"
                  auth="Container"
                  type="javax.sql.DataSource"/>
        <ResourceParams name="UserDatabase">
            <parameter>
                <name>factory</name>
                <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
            </parameter>
            <parameter>
                <name>pathname</name>
                <value>conf/tomcat-users.xml</value>
            </parameter>
        </ResourceParams>
        <ResourceParams name="jdbc/MySQL">
            <parameter>
                <name>factory</name>
                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
                <name>maxActive</name>
                <value>100</value>
            </parameter>
            <parameter>
                <name>maxIdle</name>
                <value>30</value>
            </parameter>
            <parameter>
                <name>maxWait</name>
                <value>20000</value>
            </parameter>
            <parameter>
               <name>username</name>
               <value>webapp</value>
            </parameter>
            <parameter>
               <name>password</name>
               <value>******</value>
            </parameter>
            <parameter>
                <name>removeAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>removeAbandonedTimeout</name>
                <value>3000</value>
            </parameter>
            <parameter>
                <name>logAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>url</name>
                <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
            </parameter>
        </ResourceParams>
      </GlobalNamingResources>I am still trying to get the DBTest example (described in the link to the tomcat 5 docs above) to work, only now I want it to work using a global connection pool. So here is the contents of webapps/DBTest/WEB-INF/web.xml: (again, please overlook formatting difficulties :)
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
      <description>MySQL Test App</description>
      <resource-ref>
          <description>DB Connection</description>
          <res-ref-name>jdbc/MySQL</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
      </resource-ref>
    </web-app>The last thing I need to do, I think, is to include a <resourceLink> element in the context.xml file for this webapp. Now in tomcat 5.0.* it is not recommended that the <context> element appear in the conf/server.xml file. Instead, as I understand it, it should appear in either of the two following places (for a webapp called DBTest):
    $CATALINA_HOME/conf/[engine_name]/[host_name]/DBTest.xml
    $CATALINA_HOME/webapps/DBTest/META-INF/context.xmlSince I would eventually like to package each webapp in its own war file, I prefer the second option above. This will enable me to place the context.xml file within the .war file. Currently, however, I am not using .war files.
    For the DBTest webapp I have the following <context> element in webapps/DBTest/META-INF/context.xml:
    <context path="/DBTest" docBase="/DBTest" debug="1">
        <ResourceLink global="jdbc/MySQL" name="jdbc/MySQL" type="javax.sql.DataSource" />
    </context>Now, when I point my browser to http://localhost:8080/DBTest/test.jsp I get the following message:
    javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver"
    For those who are interested, here is test.jsp:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <sql:query var="rs" dataSource="jdbc/MySQL">
    select id, foo, bar from javatest.testdata
    </sql:query>
    <html>
      <head>
        <title>DB Test</title>
      </head>
      <body>
      <h2>Results</h2>
    <c:forEach var="row" items="${rs.rows}">
        Foo ${row.foo}<br/>
        Bar ${row.bar}<br/>
    </c:forEach>
      </body>
    </html>Now I know that this is a very long and detailed question and that it is unlikely that anyone is even going to read down this far, let alone take the time to study all that XML, but if anyone is able to tell me why this setup does not allow global connection pooling, I will be pretty *@&$**% impressed. I only wish I had duke dollars to give.
    Jon

    Okay, I went back and double checked that I can get the DBTest example working. It is described here: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    I was not able to get it working exactly according to the tutorial, though. I was required to put the <context> element not in the conf/server.xml but in conf/Catalina/localhost/DBTest.xml. Then, with the DBTest/WEB-INF/web.xml as above, I was able to get the DBTest example working. The output of test.jsp (described above also) is the following:
    Results
    Foo hello
    Bar 12345I would like to be able to put the <context> element in webapps/DBTest/META-INF/context.xml (as I think should be allowed) because then I would be able to include it in a war file that encompassed the entire web application. If I am forced to put the <context> element in a subdirectory of the conf directory, then I cannot include it in a war file and I will be unable to just drop my war files in the webapps directory and go. Instead I will have to drop my war files in the webapps directory, then go and fiddle around with the xml files in conf/Catalina/localhost/
    But if I move the <context> element into webapps/DBTest/META-INF/context.xml then the example stops working. When I put it back in conf/Catalina/localhost/DBTest.xml everything is fine again.
    Ok, no big deal. I guess my war file deployment will just have to be a little more complicated.
    But what if I want the resource to be global??? If I remove the <Resource> and <ResourceParams> elements from the webapp-specific <context> element and put them in the <GlobalNamingResource> element in the conf/server.xml file I should have a global resource, right? I did this, then added a resource link to the <context> element (see above), however, the example stops working. I have tried both with and without the <resource-ref> element in web.xml.
    Can some remarkably intelligent and knowledgeable person please explain to me how global resources work in tomcat 5.0, especially global JDBC connection pooling.
    Thanks,
    Jon

  • BC4J Question: How does AM and Connection Pooling work?

    Hello everybody,
    we are just trying to understand what exactly happens when a BC4J Application Module is created / when a AM is checked out of the pool with respect to Connection and Application Module Pooling. Especially we would like to understand what ConnectionStartegies, EnvInfoProvider and SessionCookies exactly do and when and how to customize them. Especially we would like to use features like virtual private databases (VPD) and proxy authentication (a feature of the Oracle OCI JDBC driver) with BC4J application modules. We found the HowTo about using JAAS and VPDs with BC4J (http://otn.oracle.com/products/jdev/howtos/bc4j/bc4jvpdjaas.html) but there are still questions, e.g. when is the afterConnect() method of an ApplicationModuleImpl called? During the instanciation of an AM or every time it's check out of the pool?
    Any info on this topic would be very welcome!
    Regards
    Stefan

    Hi,
    1. Setting jbo.doconnectionpooling=false ,
    connection pool still exists.
    Is it correct ? When you set this parameter to false, you are saying that Connection Pool is not managed by AM, so you need to specify a JNDI Name in Application Module to use a Pool not managed by AM.
    2. There is one situation to set
    jbo.doconnectionpooling=true. The article said
    "when you have a large number of application
    module pools all needing to database connections
    from the same underlying application user at the
    database level. In this case, the many application
    module pools can perhaps economize on the total
    overall database sessions by sharing a single,
    underlying database connection pool of JDBC
    connections, albeit at a loss of efficiency of each
    one. This choice would be favored only if total
    overall database sessions is of maximum priority. "
    Does it mean that if we set it to true when we
    have many many AM instances and we cannot afford to
    have such number of connection instance in the pool
    ? It's means that the JDBC connections will be shared avoid new Connection at time.
    Normally i use Connection Pool not managed by Application Module.
    Bye

  • Question on the rpd has more then one connection pool

    Here is a question: I have create a dedicated connection pool for rpd metadata translation, the user guide says that connection pool will used only for translation,
    but when I view data from the table it make me to select a connection pool,
    so when the rpd deployed to server , how does the server decide to use which one to query data which one for the translation?

    Hi,
    When you create variables then separate connection pool plays a major role. And while creating variables you are made to choose a connection pool. So when ever the variable is called then the connection comes into picture. Same works for translation too.
    Please let me know further and hope this helped/ answered.
    Regards
    MuRam

  • A question about creating a Connection pool that uses Oracle JDBC

    Dear all,
    I have an issue with creating a connection pool within a web application in order to be used by several servlets. I appreciate if you could kindly give me a hand.
    I'm using:
    Web server: Apache-tomcat: 6.0.18
    Oracle Database 11g Enterprise: 11.1.0.6.0 - Production
    Operating system: Linux (ubuntu 8.10)
    IDE: Sun Netbeans
    Oralce JDBC Drivers: 11.1.0.7.0-Production (ojdbc6.jar and orai18n.jar)
    JDK 1.6
    Usually, just for creating a connection to my database (without using a connection pool), I proceed in the following way:
    String dbURL = "jdbc:oracle:thin:@localhost:1521:database01";
    String username = "scott";
    String user_password = "tiger";
    String userSqlQuery = "SELECT * FROM mytable";
    Connection connection = DriverManager.getConnection (dbURL, username, user_password);
    Statement statement = connection.createStatement();
    statement.executeUpdate(query_text);This works pretty well allowing to communicate with my oracle database. By this method I have run several projects
    with different queries (SELECT, INSERT, UPDATE, DELETE ,etc.) and each time it worked without any problem and
    returned the result of the query. Therefore I think that there is no problem with JDBC drivers
    However, when I want to create a connection pool, it seems that the lookup method cannot locate Oracle JDBC drivers. That is,
    try
         InitialContext ic = new InitialContext();
         Context envContext  = (Context)ic.lookup("java:/comp/env");
         dataSource = (DataSource)envContext.lookup("jdbc/oracle11gEnterprise");
           Connection connection = dataSource.getConnection();
    catch (Exception e)
         e.printStackTrace();
    }Just after calling dataSource.getConnection() the java.lang.NullPointerException is thrown.
    Any idea?
    Thanks in advance,
    And for your information, here are context.xml and web.xml files for my project
    Here is my context.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <Context antiJARLocking="true" path="/WebApplication1">
        <Resource name="jdbc/oracle11gEnterprise"
              scope="Shareable"
              type="javax.sql.DataSource"
              auth="Container"
              description="Oracle Database 11g Enterprise"
              maxActive="100"
              maxIdle="30"
              maxWait="10000"
              removeAbandoned="true"
              removeAbandonedTimeout="60"
              logAbandoned="true"
              url="jdbc:oracle:thin:@localhost:1521:database01"
              username="scott"
              password="tiger" />
    </Context>my web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
        <ConsumeOutput>false</ConsumeOutput>
        <resource-ref>
            <res-ref-name>jdbc/oracle11gEnterprise</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
        <!--
            .  And here as usual I write servlet definition and url mappings
        -->   

    nobody?

  • 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.

  • JDBC connection pool failures when used by JMS stores

              We are using WebLogic 6.1 sp2. We defined a separate connection pool for use by
              a JMS Store.
              <JDBCConnectionPool Name="sybaseJMSPool"
              Targets="cluster00"
              InitialCapacity="2"
              MaxCapacity="10"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;charset=utf8"
              URL="jdbc:sybase:Tds:@jms.db.host@/@jms.db.name@"/>
              (note that the @xxx@ string are replaced by actual values).
              We are using Sybase Jconnect 5.5 to a Sybase ASE 12.5 database.
              We deployed this configuration on a number of environments (testing, staging,
              ..). The actual hardware and network configuration is different for the different
              system, but the WebLogic domain stays the same regarding this issue.
              On the test system we frequently get the following exceptions:
              <Aug 13, 2002 1:56:04 PM CEST> <Alert> <JMS> <www00-test> <node00>
              <ExecuteThread: '6' for queue: 'JMS.TimerClientPool'> <> <> <040048>
              <JMSServer "JMSServer00", store failure while writing message for topic
              OrderChangeTopic, java.io.IOException: JMS JDBC store, connection pool =
              <sybaseJMSPool>, prefix = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              .>
              java.io.IOException: JMS JDBC store, connection pool = <sybaseJMSPool>, prefix
              = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              at weblogic.jms.store.JDBCIOStream.throwIOException
              (JDBCIOStream.java:1213)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1256)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              Before that this message appeared:
              <Aug 13, 2002 11:31:16 AM CEST> <Error> <ConnectionManager> <www00-test>
              <node00> <ExecuteThread: '26' for queue: 'default'> <> <> <000000>
              <Closing: 'weblogic.rjvm.t3.T3JVMConnection@795af6' because of: 'Server
              received a message over an uninitialized connection: 'JVMMessage from: 'null'
              to: '-4555218188801970213S:192.168.13.1:[7001,7001,7002,7002,7001,7002,-
              1]:ADIS:node00' cmd: 'CMD_REQUEST', QOS: '101', responseId: '1',
              invokableId: '287', flags: 'JVMIDs Not Sent, TX Context Not Sent', abbrev
              offset: '34'''>
              This problem did not occur on another system which was used during a 2 day stress
              testing session.
              It seems that the problem occurs after a period in which no user request where
              made. The user requests trigger EJB's that start sending JMS messages.
              When the problem occurs, the JMS messaging systems seems to lock up as no messages
              are received anymore by the different listeners (MDBs).
              Undeploying and redeploying the JBDC connection pool solves the problem. This
              solution is unacceptable in case of a production system.
              A similarly defined connection pool, which is used by the EJBs to make database
              connection, does not manifest this problem.
              <JDBCConnectionPool Name="sybasePool"
              Targets="cluster00"
              InitialCapacity="10"
              CapacityIncrement="5"
              MaxCapacity="50"
              PreparedStatementCacheSize="150"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;JCONNECT_VERSION=6;charset=utf8"
              URL="jdbc:sybase:Tds:@db.host@/@db.name@"/>
              The JDBC connection pool is used as follows by the JDBC store
              <JMSJDBCStore ConnectionPool="sybaseJMSPool" Name="JDBCStore00" PrefixName="JMS00"/>
              <JMSServer Name="JMSServer00" Store="JDBCStore00" Targets="node00">
              <JMSTopic JNDIName="ADIS.JMSError" JNDINameReplicated="false" Name="ErrorTopic"/>
              <JMSTopic JNDIName="ADIS.Status"
              Name="StatusTopic" RedeliveryDelayOverride="300000"/>
              <JMSTopic JNDIName="ADIS.OrderChange" JNDINameReplicated="false"
              Name="OrderChangeTopic" RedeliveryLimit="3"/>
              </JMSServer>
              Turning on the "Test Reserved Connection" with a appropriate test table does not
              help.
              Some sources on the internet tell us that JZ0C0 errors in the Jconnect driver
              can be related to network problems. Nevertheless the connection pool should be
              able to cope with this.
              Can you provide any solution for this ? Or give us hints what can cause the problem
              

    Zhenhao Qi wrote:
    thanks! Joe.
    The SQL statement itself can no longer be simplified, the long excuation time is due to the database size and complicated Select criteria. I can easily reproduce the problem by using this SQL. I tried "BEA's Oracle driver (Type 4): Version 8.1.7,9.0.1,9.2.0". the question can be dissect into 2 pieces:
    1) why the jdbc connection (using oracle.jdbc.OracleDriver) won't return anything if the SQL execution time > 5min, that is probably the Oracle's problem
    2) why the occupied connection pool won't release even I set "Statementtimeout=600", this is Weblogic's problem.
    ZhenhaoHi. Yes, (1) is oracle's problem. (2) may also be. The JDBC spec has very few
    allowances for one thread to interrupt a second thread's JDBC call. If we
    transmit your timeout request by calling setQueryTimeout() on the oracle
    statement, and if you have a weblogic-controlled transaction we call
    Statement.cancel() on any ongoing statement, we end up relying on whether
    the Oracle driver implements and responds to those calls.
    Are you doing weblogic-controlled transactions? Are you/can you
    call Statement.setQueryTimeout() on your statements, or are these
    generated JDBC queries?
    If you can duplicate the problem using the weblogic.jdbc.oracle.OracleDriver
    we have some other debug avenues. This would be good even if you really
    want to use the thin driver, because we will do the same JDBC calls to
    either driver, and the debug would prove (if) we set up a query timeout
    and if we call cancel(). If we do, then we can know that it is the Oracle
    driver failing in these regards.
    Joe

Maybe you are looking for

  • How can I send text messages to a group?

    Cant find an option to send a text message to a group that I have created in my contacts...either via the standard messaging app or with the Verizon messaging app.  Does that mean that neither of these apps have that capability?

  • How to use a property in a formula?

    Hello I want to use this formula to calculate an account: [F_Fi.H1].[As07]/StrToValue([TTime.H1].CurrentMember.properties("NBMONTH")),SOLVEORDER=200 When processing the dimension, I get an error : [F_Fi.H1].[H1].[#SMM1] an mdx expression was expected

  • Altiverb clicking in logic 7.2

    I have a problem with altiverb 5.1.3 cofirmed by the following test... I played an exs instrument with no fx plug ins... it played perfectly I added Logics space designer plug in... it played perfectly..i took the space designer out I added altiverb

  • Formac ADC to DVI

    Hi, I have a Formac 1900 Platinum with an ADC (male) connector and wish to connect it to an DVI connector with female input. Can anyone recommend an appropriate adaptor to handle this? regards Beya

  • Application Deployment from Remote Share

    I have a particularly large application I need to deploy and the source changes reasonably frequently so I don't want to add it to normal distribution points within SCCM. By that, I mean I don't want the entire 6GB to be copied up to the SCCM server,