Connection Caching and Connection pooling

Hi,
I have question its about a concept which has been introduced by oracle called as connection caching (not sure if its a accepted in other app servers). I had a look at it and it is similar to wht a connection pool does. So can anyone out there explain me wht is the actual difference between these ?
Thanks!

i would ignore the idea all together, unlessyour
connection has state or something, here readthis:
http://nikhilb020875.wordpress.com/2006/05/24/cache-vs
-pool/Hard to say for sure but I would guess your response
is meaningless. It certainly isn't clear to me why
you think that link is relevant.if you had read the first 2 lines from the page..I read the entire link.

Similar Messages

  • How can I make WL 8.1 flush the cache and/or pool for 1.1 EJBs

    Hi,
    I'm using 1.1 deployment descriptors for my CMP entity bean that were previously
    used in the WL 5.1 version of my project.
    Things do get deployed but I've observed confusing information when monitoring
    the EJB via Admin Console.
    What appears is that the Weblogic container is not flushing the cache and/or pool
    after the bean has finished processing and also a sufficient time has expired
    (i.e. the idle-timeout-seconds)
    From what I've understood via the on-line information is that each EJB has its
    own cache (since I've not done anything special for that) and the instance in
    cache is only passivated when the cache is full and the server need to activate
    another instance. On passivation, it appears to be returning the instance to the
    pool. But its unclear/undocumented when the pool is cleared, if at all.
    What I want is that:
    1. A way to get my cached instance passivated
    2. A way to get my pooled instance flushed.
    The reason I'm looking into this is becasue in my case it appears that the cached/pooled
    instance are contributing to OutOfMemory errors and because of the nature of requirements,
    etc. we need to have the cache size be high for certain processing.
    Thanks
    Parasher

    I think it's probably best to contact technical support about this.
    There are different patches for different versions of WLS.
    I'd mention 'CR128026' to them to get started.
    -thorick
    "Parasher" <[email protected]> wrote:
    >
    Hi,
    Thank you for your reply !
    How can I get more information about this patch and the patch itself
    Is there a way I can look it up online or do I have to contact the support
    folks
    and if so what should I need to tell them to convey which patch I'm talking
    about.
    Thank you in advance.
    Parasher
    "thorick" <[email protected]> wrote:
    Hi,
    If you use 'Database' concurrency, then there is a patch available for
    some 8.1
    service
    packs to enable idle-timeout-seconds on the cache. I believe that this
    will be
    standard
    feature with the next service pack. There is no comparable mechanism
    for the
    pool in 8.1,
    this is a feature that is coming with the next major release of WLS.
    If the
    8.1 patch works
    for you, it can save you memory during off peak usage times. Notethat
    this
    patch does not
    work for 'Exclusive' concurrency.
    -thorick

  • 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

  • Cache and/or Connection problems under load

    I have a Kodo web app that's been running just fine in
    production for many months now. However, recently the web
    traffic has shot up by a huge amount, literally overnight.
    But unfortunately, it's caused the app to fail very ungracefully
    under the strain.
    It's been a crazy few days, and I haven't been able to do
    very much analysis because of higher priorities. But from
    what I have been able to gleen, it now looks like Kodo is
    the most likely culprit. From what I've read in other messages
    here, it appears others may have been experiencing similar
    problems.
    My environment: Redhat Linux 8, Postgres 7.3.4 with the
    included JDBC3 driver, Apache 1.3.x, Tomcat 4.1.x and the
    webapp connector. Similar behavior was seen with Apache 2.x,
    Tomcat 4.1.x and the JK2 connector (that was on the new machine
    I setup to handle the new traffic, which, of course, died the
    night before).
    As I mentioned, this app has been running reliably for
    months with no problems. But when placed under heavy load,
    it appears to get into some sort of pathological state where
    it slows down dramatically (asymptotically?) to the point where
    it's effectively locked up. In one case, where the app was
    left running for several hours in this state, requests were
    taking 90 minutes to complete (normal is 1-5 seconds).
    From what I can deduce, there seem to be four things
    going on, three of which have been mentioned in recent threads
    here:
    1) Excessive memory consumption. When the app is
    operating normally, I see fairly flat memory usage for
    the JVM process. Under load, the JVM steadily expands
    until it hits its heap limit. I've gotten OutOfMemory
    exceptions with a heap size of 350MB, which should be plenty.
    2) Level 2 cache locking issues. I've seen dozens of
    threads waiting on a lock in the DataCache code. Not sure
    if there's a deadlock happening here or just that the
    threads are waiting on a lock that's being held for a long time.
    3) Database Connection leaks or contention. I see threads
    spinning in the DataSource code trying to get a connection.
    I also see dozens of connections from the Postgres side which
    seem to be sitting idle, but in the middle of a transaction.
    When things get bad, I also see exceptions being thrown because
    of timeouts waiting for a connection to become available. It's
    a web app, PMs should not be tied up for more than a few seconds.
    4) CPU usage pegged or nearly so for the JVM. I suspect
    this is related to #3. Something very bad is going on here.
    If I stop all inbound requests to the JVM when it's in this
    bad state, it will continue to burn CPU at 90%+ for a very
    long time. I think it will eventually finish what it's doing,
    but I haven't had the luxury of waiting for it. It's definitely
    not a linear slowdown proportional to the load.
    Attached are my kodo.properties file and some thread stack
    traces along with some comments. Any advice would be greatly
    appreciated. This is not a complicated app nor am I doing
    anything unusual. It doesn't seem logical that Kodo could
    breakdown so dramatically under load, so I'm hoping it's some
    sort of interaction thing that I can work around.
    Thanks.
    Ron Hitchens {mailto:[email protected]} RonSoft Technologies
    (510) 494-9597 (Home Office) http://www.ronsoft.com
    (707) 924-3878 (fax) Bit Twiddling At Its Finest
    "Born with a broken heart" -Kenny Wayne Shepard

    Please read prior posts regarding level 2 cache. It is unusable under stress
    as far I am concerned. Basically entire cache gets locked on any database
    read. Makes it very unscalable
    Are you using 2.5.3? It will request a connection from a pool every time it
    resolves reference to a PC even if it is cached in PM and therefore Kodo
    does not need to read any. As result if you iterate over 100 objects in your
    query and for each object resolve reference to another object (always the
    same) kodo will request 100 database connections from the pool (and note
    they issue rollback on every time they return a connection to the pool so
    getting connection might be fairly expensive)
    In conjunction with level 2 cache contention this causes application to go
    into a stupor.
    Try to go back to 2.5.2 (or may be 2.5.4 they promised in the near future
    with a workaround) or use "persistent-manager" connection retention if you
    discard PM after each HTTP invocation - it will take care of connection
    pooling issue. As far as L2 cache I was unable to find any work around so
    far - see if you might be better of without cache. You might if your object
    graph is not very complex
    "Ron Hitchens" <[email protected]> wrote in message
    news:[email protected]...
    >
    I have a Kodo web app that's been running just fine in
    production for many months now. However, recently the web
    traffic has shot up by a huge amount, literally overnight.
    But unfortunately, it's caused the app to fail very ungracefully
    under the strain.
    It's been a crazy few days, and I haven't been able to do
    very much analysis because of higher priorities. But from
    what I have been able to gleen, it now looks like Kodo is
    the most likely culprit. From what I've read in other messages
    here, it appears others may have been experiencing similar
    problems.
    My environment: Redhat Linux 8, Postgres 7.3.4 with the
    included JDBC3 driver, Apache 1.3.x, Tomcat 4.1.x and the
    webapp connector. Similar behavior was seen with Apache 2.x,
    Tomcat 4.1.x and the JK2 connector (that was on the new machine
    I setup to handle the new traffic, which, of course, died the
    night before).
    As I mentioned, this app has been running reliably for
    months with no problems. But when placed under heavy load,
    it appears to get into some sort of pathological state where
    it slows down dramatically (asymptotically?) to the point where
    it's effectively locked up. In one case, where the app was
    left running for several hours in this state, requests were
    taking 90 minutes to complete (normal is 1-5 seconds).
    From what I can deduce, there seem to be four things
    going on, three of which have been mentioned in recent threads
    here:
    1) Excessive memory consumption. When the app is
    operating normally, I see fairly flat memory usage for
    the JVM process. Under load, the JVM steadily expands
    until it hits its heap limit. I've gotten OutOfMemory
    exceptions with a heap size of 350MB, which should be plenty.
    2) Level 2 cache locking issues. I've seen dozens of
    threads waiting on a lock in the DataCache code. Not sure
    if there's a deadlock happening here or just that the
    threads are waiting on a lock that's being held for a long time.
    3) Database Connection leaks or contention. I see threads
    spinning in the DataSource code trying to get a connection.
    I also see dozens of connections from the Postgres side which
    seem to be sitting idle, but in the middle of a transaction.
    When things get bad, I also see exceptions being thrown because
    of timeouts waiting for a connection to become available. It's
    a web app, PMs should not be tied up for more than a few seconds.
    4) CPU usage pegged or nearly so for the JVM. I suspect
    this is related to #3. Something very bad is going on here.
    If I stop all inbound requests to the JVM when it's in this
    bad state, it will continue to burn CPU at 90%+ for a very
    long time. I think it will eventually finish what it's doing,
    but I haven't had the luxury of waiting for it. It's definitely
    not a linear slowdown proportional to the load.
    Attached are my kodo.properties file and some thread stack
    traces along with some comments. Any advice would be greatly
    appreciated. This is not a complicated app nor am I doing
    anything unusual. It doesn't seem logical that Kodo could
    breakdown so dramatically under load, so I'm hoping it's some
    sort of interaction thing that I can work around.
    Thanks.
    Ron Hitchens {mailto:[email protected]} RonSoft Technologies
    (510) 494-9597 (Home Office) http://www.ronsoft.com
    (707) 924-3878 (fax) Bit Twiddling At Its Finest
    "Born with a broken heart" -Kenny Wayne Shepard
    With cahce enabled, 2.5.3
    Here the app had recently slowed down and then effectively locked up.
    There where many outstanding web requests that were not receiving output.
    At this point most threads seemed to be waiting at the same location.
    There were a large number of active database connections and most of
    them had open transactions (according to pg_stat_activity). The app
    was not responding to any web requests.
    It would seem that db transactions had been started, then the thread
    got stuck for a long time on a synchronization lock in the cache lookup.
    Below are two randomly chosen thread stack dumps.
    Thread-72[1] where
    [1] java.lang.Object.wait (native method)
    [2] java.lang.Object.wait (Object.java:429)
    [3]oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock$ReaderLock.acquir
    e (WriterPreferenceReadWriteLock.java:169)
    [4]com.solarmetric.kodo.runtime.datacache.AbstractCacheImpl.acquireReadLock
    (AbstractCacheImpl.java:384)
    [5]com.solarmetric.kodo.runtime.datacache.TimedDataCache.acquireReadLock
    (TimedDataCache.java:256)
    [6] com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.load(DataCacheStoreManager.java:595)
    [7] com.solarmetric.kodo.runtime.StateManagerImpl.loadFields(StateManagerImpl.java:2,330)
    [8] com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java:897)
    [9] com.europeasap.data.City.jdoGetname (null)
    [10] com.europeasap.data.City.getName (City.java:39)
    [11] com.europeasap.form.CustomerBookingForm.populateDepartureCityInfo(CustomerBookingForm.java:922)
    [12] com.europeasap.form.CustomerBookingForm.onetimeInit(CustomerBookingForm.java:871)
    [13] com.europeasap.form.CustomerBookingForm.populatePackageInfo(CustomerBookingForm.java:880)
    [14] com.europeasap.action.CustomizeTrip.perform (CustomizeTrip.java:66)
    [15] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1,787)
    [16] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1,586) [17]
    org.apache.struts.action.ActionServlet.doGet (ActionServlet.java:492)
    [18] javax.servlet.http.HttpServlet.service (HttpServlet.java:740)
    [19] javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
    [20] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    [21] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    [22] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
    [23]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [24] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [25] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [26] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    [27]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [28] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    [29]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [30] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [31] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [32] org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2,415)
    [33] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    [34]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [35] org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    [36]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [37] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    [38]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [39] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [40] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [41] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    [42]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [43] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [44] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [45] org.apache.catalina.connector.warp.WarpRequestHandler.handle (null)
    [46] org.apache.catalina.connector.warp.WarpConnection.run (null)
    [47] java.lang.Thread.run (Thread.java:534)
    Thread-64[1] where
    [1] java.lang.Object.wait (native method)
    [2] java.lang.Object.wait (Object.java:429)
    [3]oswego.cs.dl.util.concurrent.WriterPreferenceReadWriteLock$ReaderLock.acquir
    e (WriterPreferenceReadWriteLock.java:169)
    [4]com.solarmetric.kodo.runtime.datacache.AbstractCacheImpl.acquireReadLock
    (AbstractCacheImpl.java:384)
    [5]com.solarmetric.kodo.runtime.datacache.TimedDataCache.acquireReadLock
    (TimedDataCache.java:256)
    [6] com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.load(DataCacheStoreManager.java:595)
    [7] com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.java:2,248)
    [8] com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java:899)
    [9] com.europeasap.data.HotelPrices.jdoGetseasonalPrices (null)
    [10] com.europeasap.data.HotelPrices.normalizeIndex(HotelPrices.java:113)
    [11] com.europeasap.data.HotelPrices.getCost (HotelPrices.java:45)
    [12] com.europeasap.logic.CostHelper.findLowestHotel(CostHelper.java:181)
    [13] com.europeasap.logic.CostHelper.computeBasePackageCost(CostHelper.java:297)
    [14] com.europeasap.logic.CostHelper.computeFinalPackageCost(CostHelper.java:246)
    [15] com.europeasap.form.CustomerBookingForm.updateDisplayCosts(CustomerBookingForm.java:1,440)
    [16] com.europeasap.form.CustomerBookingForm.updateCustomizeDisplayInfo(CustomerBookingForm.java:1,407)
    [17] com.europeasap.action.CustomizeTrip.perform (CustomizeTrip.java:68)
    [18] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1,787)
    [19] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1,586) [20]
    org.apache.struts.action.ActionServlet.doGet (ActionServlet.java:492)
    [21] javax.servlet.http.HttpServlet.service (HttpServlet.java:740)
    [22] javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
    [23] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    [24] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    [25] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
    [26]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [27] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [28] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [29] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    [30]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [31] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    [32]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [33] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [34] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [35] org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2,415)
    [36] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    [37]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [38] org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    [39]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [40] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    [41]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [42] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [43] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [44] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    [45]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [46] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [47] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [48] org.apache.catalina.connector.warp.WarpRequestHandler.handle (null)
    [49] org.apache.catalina.connector.warp.WarpConnection.run (null)
    [50] java.lang.Thread.run (Thread.java:534)
    while running slow, 2.5.3
    At this point, the app had been running several hours normally, then
    apparently slowed down and locked up while I was away. When looking
    at the app threads and database activity, everything appeared idle.
    No transactions seemed to be open in the db. But the app was not
    behaving normally. Web requests that did not make use of JDO worked
    fine (but slow). But requests that hit the db either blocked or were
    very slow to respond.
    Looking back at the log, there had been a large number of requests
    that threw exceptions because they could not get a connection within
    five seconds.
    Most threads were idle, waiting on read, but some were in the state
    shown by the following two stack dumps. Unlike the cache threads above,
    they did not seem to be waiting for a lock to be granted, they seemed
    to be spinning in the connection management code. Apparently trying
    to get a connection. I suspended and resumed the same thread repeatedly
    and it always seemd to be doing the same thing. Single stepping was
    very difficult because the debugger was slow to respond, apparently
    because of other threads also busy spinning.
    Postgres indicated that there where lots of connections open and
    that they were all idle, so there should not have been a shortage
    of connections in the pool. There are two mysteries here: 1) why
    can't this thread get a connection? and 2) Why is it busy spinning?
    Thread-56[1] where
    [1]com.solarmetric.datasource.PreparedStatementCache$CacheAwareConnection.prepa
    reStatement (PreparedStatementCache.java:184)
    [2]com.solarmetric.datasource.PreparedStatementCache$CacheAwareConnection.prepa
    reStatement (PreparedStatementCache.java:169)
    [3] com.solarmetric.datasource.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:199)
    [4]com.solarmetric.kodo.impl.jdbc.schema.dict.AbstractDictionary.isClosed
    (AbstractDictionary.java:1,912)
    [5]com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.getConnectionFromFact
    ory (SQLExecutionManagerImpl.java:186)
    [6] com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.getConnection(SQLExecutionManagerImpl.java:147)
    [7]com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.newSQLExecutionManag
    er (JDBCStoreManager.java:828)
    [8]com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getSQLExecutionManag
    er (JDBCStoreManager.java:714)
    [9]com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDatastoreConnecti
    on (JDBCStoreManager.java:287)
    [10]com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.getDatastoreCon
    nection (DataCacheStoreManager.java:465)
    [11] com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.load(DataCacheStoreManager.java:591)
    [12] com.solarmetric.kodo.runtime.StateManagerImpl.loadFields(StateManagerImpl.java:2,330)
    [13] com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java:897)
    [14] com.europeasap.data.City.jdoGetname (null)
    [15] com.europeasap.data.City.getName (City.java:39)
    [16] com.europeasap.form.CustomerBookingForm.populateDepartureCityInfo(CustomerBookingForm.java:922)
    [17] com.europeasap.form.CustomerBookingForm.onetimeInit(CustomerBookingForm.java:871)
    [18] com.europeasap.form.CustomerBookingForm.populatePackageInfo(CustomerBookingForm.java:880)
    [19] com.europeasap.action.CustomizeTrip.perform (CustomizeTrip.java:66)
    [20] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1,787)
    [21] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1,586) [22]
    org.apache.struts.action.ActionServlet.doGet (ActionServlet.java:492)
    [23] javax.servlet.http.HttpServlet.service (HttpServlet.java:740)
    [24] javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
    [25] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    [26] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    [27] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
    [28]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [29] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [30] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [31] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    [32]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [33] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    [34]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [35] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [36] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [37] org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2,415)
    [38] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    [39]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [40] org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    [41]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [42] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    [43]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [44] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [45] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [46] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    [47]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [48] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [49] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [50] org.apache.catalina.connector.warp.WarpRequestHandler.handle (null)
    [51] org.apache.catalina.connector.warp.WarpConnection.run (null)
    [52] java.lang.Thread.run (Thread.java:534)
    Thread-56[1] where
    [1]com.solarmetric.datasource.DataSourceImpl$AbstractPool.findConnection
    (DataSourceImpl.java:826)
    [2] com.solarmetric.datasource.DataSourceImpl$AbstractPool.getConnection(DataSourceImpl.java:605)
    [3] com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:363)
    [4] com.solarmetric.datasource.DataSourceImpl.getConnection(DataSourceImpl.java:356)
    [5]com.solarmetric.kodo.impl.jdbc.runtime.DataSourceConnector.getConnection
    (DataSourceConnector.java:63)
    [6]com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.getConnectionFromFact
    ory (SQLExecutionManagerImpl.java:185)
    [7] com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.getConnection(SQLExecutionManagerImpl.java:147)
    [8]com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.newSQLExecutionManag
    er (JDBCStoreManager.java:828)
    [9]com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getSQLExecutionManag
    er (JDBCStoreManager.java:714)
    [10]com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.getDatastoreConnecti
    on (JDBCStoreManager.java:287)
    [11]com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.getDatastoreCon
    nection (DataCacheStoreManager.java:465)
    [12]com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.initialize
    (DataCacheStoreManager.java:519)
    [13] com.solarmetric.kodo.runtime.StateManagerImpl.loadInitialState(StateManagerImpl.java:215)
    [14]com.solarmetric.kodo.runtime.PersistenceManagerImpl.getObjectByIdFilter
    (PersistenceManagerImpl.java:1,278)
    [15] com.solarmetric.kodo.runtime.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:1,179)
    [16]com.solarmetric.kodo.runtime.datacache.query.CacheAwareQuery$CachedResultLis
    t.get (CacheAwareQuery.java:432)
    [17] java.util.AbstractList$Itr.next (AbstractList.java:421)
    [18] com.europeasap.form.CustomerBookingForm.populateDepartureCityInfo(CustomerBookingForm.java:919)
    [19] com.europeasap.form.CustomerBookingForm.onetimeInit(CustomerBookingForm.java:871)
    [20] com.europeasap.form.CustomerBookingForm.populatePackageInfo(CustomerBookingForm.java:880)
    [21] com.europeasap.action.CustomizeTrip.perform (CustomizeTrip.java:66)
    [22] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1,787)
    [23] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1,586) [24]
    org.apache.struts.action.ActionServlet.doGet (ActionServlet.java:492)
    [25] javax.servlet.http.HttpServlet.service (HttpServlet.java:740)
    [26] javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
    [27] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    [28] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    [29] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
    [30]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [31] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [32] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [33] org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    [34]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [35] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
    [36]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [37] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [38] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [39] org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2,415)
    [40] org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    [41]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [42] org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    [43]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [44] org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
    [45]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:641)
    [46] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [47] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [48] org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    [49]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [50] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [51] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [52] org.apache.catalina.connector.warp.WarpRequestHandler.handle (null)
    [53] org.apache.catalina.connector.warp.WarpConnection.run (null)
    [54] java.lang.Thread.run (Thread.java:534)
    With cache disabled 2.4.3
    This run was an accident. I inadvertently ran the app with the older
    2.4.3 version of Kodo, with the cache disabled. This one got into trouble
    almost immediately. It also seemed to lockup with lots of opentransactions
    in the db. It's also interesting that these two threads also seem to be
    hanging around the same method as in 2.5.3.
    Thread-63[1] where 0x9f9
    [1]com.solarmetric.datasource.PreparedStatementCache$CacheAwareConnection.prepa
    reStatement (PreparedStatementCache.java:184)
    [2] com.solarmetric.datasource.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:377)
    [3]com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.prepareStatementInter
    nal (SQLExecutionManagerImpl.java:807)
    [4]com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedQueryI
    nternal (SQLExecutionManagerImpl.java:761)
    [5]com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQueryInternal
    (SQLExecutionManagerImpl.java:691)
    [6] com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:372)
    [7] com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeQuery(SQLExecutionManagerImpl.java:356)
    [8] com.solarmetric.kodo.impl.jdbc.ormapping.ClassMapping.loadByPK(ClassMapping.java:950)
    [9] com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.initialize(JDBCStoreManager.java:263)
    [10] com.solarmetric.kodo.runtime.StateManagerImpl.loadInitialState(StateManagerImpl.java:174)
    [11]com.solarmetric.kodo.runtime.PersistenceManagerImpl.getObjectByIdFilter
    (PersistenceManagerImpl.java:1,023)
    [12] com.solarmetric.kodo.runtime.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:942)
    [13] com.solarmetric.kodo.impl.jdbc.ormapping.OneToOneMapping.load(OneToOneMapping.java:147)
    [14] com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.load(JDBCStoreManager.java:375)
    [15] com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.java:2,035)
    [16] com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java:720)
    [17] com.europeasap.data.CityMarkup.jdoGetcity (null)
    [18] com.europeasap.data.CityMarkup.getCity (CityMarkup.java:30)
    [19] com.europeasap.logic.CostHelper.getCityMarkup (CostHelper.java:81)
    [20] com.europeasap.logic.CostHelper.computeBasePackageCost(CostHelper.java:289)
    [21] com.europeasap.logic.CostHelper.computeFinalPackageCost(CostHelper.java:246)
    [22] com.europeasap.form.CustomerBookingForm.updateDisplayCosts(CustomerBookingForm.java:1,440)
    [23] com.europeasap.form.CustomerBookingForm.updateCustomizeDisplayInfo(CustomerBookingForm.java:1,407)
    [24] com.europeasap.action.CustomizeTrip.perform (CustomizeTrip.java:68)
    [25] org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1,787)
    [26] org.apache.struts.action.ActionServlet.process(ActionServlet.java:1,586) [27]
    org.apache.struts.action.ActionServlet.doPost (ActionServlet.java:510)
    [28] javax.servlet.http.HttpServlet.service (HttpServlet.java:760)
    [29] javax.servlet.http.HttpServlet.service (HttpServlet.java:853)
    [30] org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    [31] org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    [32] org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
    [33]org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
    eNext (StandardPipeline.java:643)
    [34] org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
    [35] org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
    [36] org.apache.catal

  • WLS 10.3.0.0 Solaris SPARC and DBMS Oracle 10gR2 connection pooling issue

    Hi all,
    we are currently testing Weblogic Server 10.3.0.0 in order to migrate our production system from WLS 8.1 to it.
    While testing the new setup, we encountered some strange behaviour of the connection pooling within WLS.
    We configured a XA-Connection pool to our DB (Oracle 10gR2) by using
    a) the Oracle XA-thin-driver delivered within WLS 10.3.0.0
    and alternatively
    b) the Oracle 11.2.0.2 OCI-driver of the Oracle 11g database client.
    We´ve got the same issue with both variants. We defined an initial capacity of 5 connections and a maximum capacity of 30 connections.
    Our application is running flawlessly using the connection pool, but the amount of active sessions between the application server and the database server is increasing rapidly and the maximum capacity is exceeded. We are seeing up to multiple hundreds of sessions from the application server to our database server. Obviously the connections aren´t cleaned up.
    We are using the following settings for the JDBC-Connection:
    initial capacity = 5
    max. capacity = 30
    Capacity increment = 1
    Statement cache type = LRU
    Statement cache size = 10
    Test connections on reserve = true
    Test frequency = 120
    Test table name = "sql select 1 from dual"
    seconds to trust an idle pool connection = 10
    shrink frequency = 0
    connecttion creation retry frequency = 120
    login delay = 0
    incative connection timeout = 10
    max. waiting for connection = 2147483647
    connection reserve timeout= = -1
    Ignare in-use connections = true
    pinned-to-thread = false
    remoce infected connections enabled = true
    Does anyone have an idea how to track/solve this issue?
    Kind regards
    Marc

    Hi Joe,
    we´ve tested with the thin driver using an initial capacity of 5 and a maximum capacity of 15. During our tests (in a very short time period) the maximum capacity has not been exceeded. But we saw some exceptions in the managed server logfile which made us curious.
    When these exceptions are occuring, a new connection to the database server is established. We are seeing for a short time a total count of 6 connections which is immediately decreasing to the initial capacity of 5. We will do some further testing over the next hours and monitor the connection usage.
    The connection we are dealing with is the one called "ZDB2".
    This is an excerpt of the logfile:
    ####<18.10.2010 19:45 Uhr MESZ> <Debug> <JDBCConn> <SERVER-NAME> <MANAGED SERVER NAME> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-02F7EA174F1D84653A69> <> <1287423940610> <BEA-000000> <java.lang.Exception: Pinned: autoCommit=true,enabled=true,isXA=true,isJTS=false,vendorID=0,connUsed=true,doInit=false,'null',destroyed=false,poolname=ZDB2,appname=null,moduleName=null,connectTime=177,dirtyIsolationLevel=false,initialIsolationLevel=2,infected=true,lastSuccessfulConnectionUse=1287423940605,secondsToTrustAnIdlePoolConnection=10,currentUser=java.lang.Exception
         at weblogic.jdbc.common.internal.ConnectionEnv.setup(ConnectionEnv.java:308)
         at weblogic.common.resourcepool.ResourcePoolImpl.reserveResource(ResourcePoolImpl.java:314)
         at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:427)
         at weblogic.jdbc.common.internal.ConnectionPool.reserve(ConnectionPool.java:316)
         at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:93)
         at weblogic.jdbc.common.internal.ConnectionPoolManager.reserve(ConnectionPoolManager.java:61)
         at weblogic.jdbc.jta.DataSource.getXAConnectionFromPool(DataSource.java:1473)
         at weblogic.jdbc.jta.DataSource.refreshXAConnAndEnlist(DataSource.java:1272)
         at weblogic.jdbc.jta.DataSource.getConnection(DataSource.java:425)
         at weblogic.jdbc.jta.DataSource.connect(DataSource.java:382)
         at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:338)
         at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69)
         at org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
         at org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
         at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
         at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
         at org.hibernate.loader.Loader.doQuery(Loader.java:673)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderPersistenceGenerated.findByPrimaryKey(OrderPersistenceGenerated.java:45)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceImplStandard.findOrderByPrimaryKey(OrderManagementServiceImplStandard.java:1356)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceTransactionHandler.findOrderByPrimaryKeyTx(OrderManagementServiceTransactionHandler.java:830)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceSessionBean.findOrderByPrimaryKey(OrderManagementServiceSessionBean.java:1276)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_ELOImpl.findOrderByPrimaryKey(OrderManagementEJB_yb2dzq_ELOImpl.java:19812)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceApplicationProxy.findOrderByPrimaryKey(OrderManagementServiceApplicationProxy.java:1289)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceTransactionHandler.findOrderByPrimaryKey(OrderManagementServiceTransactionHandler.java:823)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceImplStandard.findOrderByPrimaryKey(OrderManagementServiceImplStandard.java:1341)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceTransactionHandler.findOrderByPrimaryKeyTx(OrderManagementServiceTransactionHandler.java:816)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceSessionBean.findOrderByPrimaryKey(OrderManagementServiceSessionBean.java:1255)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_ELOImpl.findOrderByPrimaryKey(OrderManagementEJB_yb2dzq_ELOImpl.java:7332)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceApplicationProxy.findOrderByPrimaryKey(OrderManagementServiceApplicationProxy.java:1266)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceTransactionHandler.findOrderByPrimaryKey(OrderManagementServiceTransactionHandler.java:809)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceImpl.publishOrder(OrderManagementServiceImpl.java:1636)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceImpl.savePublishedOrder(OrderManagementServiceImpl.java:1606)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceTransactionHandler.savePublishedOrderTx(OrderManagementServiceTransactionHandler.java:3467)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceSessionBean.savePublishedOrder(OrderManagementServiceSessionBean.java:5272)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl.savePublishedOrder(OrderManagementEJB_yb2dzq_EOImpl.java:3263)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl_WLSkel.internalInvoke2(Unknown Source)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl_WLSkel.internalInvoke1(Unknown Source)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
         at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
         at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    ,currentThread=Thread[[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)',5,Pooled Threads],lastUser=null,currentError=null,currentErrorTimestamp=null,JDBC4Runtime=true,supportStatementPoolable=true,needRestoreClientInfo=false,defaultClientInfo={} is set to be refreshed
         at weblogic.jdbc.common.internal.ConnectionEnv.setRefreshNeeded(ConnectionEnv.java:518)
         at weblogic.jdbc.wrapper.Connection.getVendorConnection(Connection.java:292)
         at de.dpcom.persistence.hibernate.BinaryBlobType.nullSafeSet(BinaryBlobType.java:109)
         at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:146)
         at org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997)
         at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2371)
         at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2307)
         at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2607)
         at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:92)
         at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:232)
         at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
         at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
         at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
         at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
         at APPNAME-ROOT-PATH.components.customermanagement.biz.CertificatePersistenceGenerated.updateCertificate(CertificatePersistenceGenerated.java:116)
         at APPNAME-ROOT-PATH.components.customermanagement.biz.CustomerManagementServiceImplStandard.updateCertificate(CustomerManagementServiceImplStandard.java:1282)
         at APPNAME-ROOT-PATH.components.customermanagement.biz.CustomerManagementServiceTransactionHandler.updateCertificateTx(CustomerManagementServiceTransactionHandler.java:711)
         at APPNAME-ROOT-PATH.components.customermanagement.biz.CustomerManagementServiceSessionBean.updateCertificate(CustomerManagementServiceSessionBean.java:1104)
         at APPNAME-ROOT-PATH.components.customermanagement.biz.CustomerManagementEJB_ap2i9a_ELOImpl.updateCertificate(CustomerManagementEJB_ap2i9a_ELOImpl.java:19199)
         at APPNAME-ROOT-PATH.components.customermanagement.biz.CustomerManagementServiceApplicationProxy.updateCertificate(CustomerManagementServiceApplicationProxy.java:1101)
         at APPNAME-ROOT-PATH.components.productionresultprocessing.biz.ProductionResultProcessingServiceImpl.publishCertificate(ProductionResultProcessingServiceImpl.java:1131)
         at APPNAME-ROOT-PATH.components.productionresultprocessing.biz.ProductionResultProcessingServiceTransactionHandler.publishCertificateTx(ProductionResultProcessingServiceTransactionHandler.java:298)
         at APPNAME-ROOT-PATH.components.productionresultprocessing.biz.ProductionResultProcessingServiceSessionBean.publishCertificate(ProductionResultProcessingServiceSessionBean.java:517)
         at APPNAME-ROOT-PATH.components.productionresultprocessing.biz.ProductionResultProcessingServiceSessionBean_yaua6q_ELOImpl.publishCertificate(ProductionResultProcessingServiceSessionBean_yaua6q_ELOImpl.java:1804)
         at APPNAME-ROOT-PATH.components.productionresultprocessing.biz.ProductionResultProcessingServiceApplicationProxy.publishCertificate(ProductionResultProcessingServiceApplicationProxy.java:471)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceImpl.publishCertificate(OrderManagementServiceImpl.java:1825)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceImpl.publishOrder(OrderManagementServiceImpl.java:1664)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceImpl.savePublishedOrder(OrderManagementServiceImpl.java:1606)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceTransactionHandler.savePublishedOrderTx(OrderManagementServiceTransactionHandler.java:3467)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementServiceSessionBean.savePublishedOrder(OrderManagementServiceSessionBean.java:5272)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl.savePublishedOrder(OrderManagementEJB_yb2dzq_EOImpl.java:3263)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl_WLSkel.internalInvoke2(Unknown Source)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl_WLSkel.internalInvoke1(Unknown Source)
         at APPNAME-ROOT-PATH.components.ordermanagement.biz.OrderManagementEJB_yb2dzq_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
         at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
         at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    >
    ####<18.10.2010 19:45 Uhr MESZ> <Info> <JDBC> <SERVER-NAME> <MANAGED SERVER NAME> <[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1287423940797> <BEA-001072> <Connection for XA pool "ZDB2" created.>
    ####<18.10.2010 19:45 Uhr MESZ> <Info> <JDBC> <SERVER-NAME> <MANAGED SERVER NAME> <[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1287423940808> <BEA-001132> <Initialized statement cache of size "10" for connection in pool "ZDB2".>
    ####<18.10.2010 19:45 Uhr MESZ> <Info> <Common> <SERVER-NAME> <MANAGED SERVER NAME> <[ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1287423940808> <BEA-000628> <Created "1" resources for pool "ZDB2", out of which "1" are available and "0" are unavailable.>
    Any suggestions?
    Kind regards
    Marc

  • Reuse of preparedstatements and the connection pool

    It seems useful (for performance reasons) to reuse a prepared statement in
    subsequent calls to the database. In WebLogic, however, after each call we
    return the Connection object to the WebLogic connection pool. A prepared
    statement is created on a specific Connection object. The next time we want
    to use the same query we get a Connection from the pool, which might be
    another instance of the Connection class. Therefor it seems impossible or at
    least dangerous to reuse the same prepared statement. Even in the case this
    would work we're indirectly using the other Connection, which we already
    returned to the pool and which could be retrieved from the pool by someone
    else. So, can't we reuse preparedstatements ?

    Hi Raja,
    Currently the only bullet-proof way to make sure that all statements are
    cached is to set the cache size to a number of possible prepared statements
    in the application.
    The only consequence of increased cache size is growing amount of
    memory required by a server instance.
    Regards,
    Slava Imeshev
    "Rajiv Jauhari" <[email protected]> wrote in message
    news:[email protected]...
    Is there an easy way to tell whether the prepared statement cache size one
    has set is
    appropriate? Some way to monitor cache hit rate or usage count (i.e., the
    actual number of statements cached) while running a load test? I'm using
    Weblogic 6.1sp3 and Oracle 8.1.7.4.
    Another way to think of this question is: is there a negative impact ifthe
    cache size is set too large?
    In the case of Oracle I believe one might run out of cursors, but is there
    any other negative consequence that you know of?
    Thanks,
    Rajiv
    "Joseph Weinstein" <[email protected]> wrote in message
    news:[email protected]...
    Vyas wrote:
    If multiples (of the same statement) can be cached would it not result
    in too many
    prepared statements of the same type in the cache ?
    This could happen
    1. When a load test is done when all the threads start doing exactly
    the
    same work.
    Because of contention everybody gets their own statement copy(theoritically, even
    if in practice it may not exactly happen like that). In such a case
    you
    are going
    to create load on the database in terms of open cursors.Each thread will get it's own connection, and the statement cache isper-connection.
    Cursors, in Oracle's case, do need to be configured to support acache-full of
    retained statements. Alternately, the cache should be set to a smallenough size to
    require only as many cursors as the DBMS will allow per connection.
    Another issue is what happens when the cache limit is hit ?
    In the above example let's say cache limit is 50 and I am doing 50
    user
    load test.
    because of load test let's say the cache gets filled with 50 of the
    same
    statement.
    When load test moves to the next sequence of action requiring a
    diffrent
    statement
    what happens to the cache ?
    thanks
    VyasThe only way a given connection's statement cache will get a duplicatestatement
    is if some single JDBC thread required multiple copies of the samestatement. A
    multi-user test will usually just ensure that each pooled connectioncaches the
    same selection of different statements that the test user used. If thetest user
    just repeatedly makes and uses one statement, the first time they do it,the
    statement will be cached, and every subsequent repeat of the user codewill get
    the same cached statement. The cache will still have 49 empty slotswaiting for
    different statements. Currently the cache is simple-minded. It is a
    fixed
    (configurable)
    size per connection, and the first N prepared/callable statements getcached for the
    life of the pooled connection that created them. All other subsequentstatements will
    be made and closed on a per-connection-use basis. Therefore, it can bethat a startup
    or stress load that runs before standard runtime service, and which usessignificantly
    different a statement profile could populate the cache with rarely-usedwasted statements.
    If I were a customer in this circumstance, I would either prime thecaches, by determining
    which statements I wanted cached, and then running a startup class thatreserved all the
    pool connections, and made these statements on each before closing them.Alternately,
    after startup/stress I would reset the pool, and allow the runtime load
    to
    fill the cache of
    the regenerated pool.
    Joe Weinstein at B.E.A.
    thanks
    Vyas
    Joseph Weinstein <[email protected]> wrote:
    JS wrote:
    It seems useful (for performance reasons) to reuse a prepared
    statement
    in
    subsequent calls to the database. In WebLogic, however, after each
    call
    we
    return the Connection object to the WebLogic connection pool. A
    prepared
    statement is created on a specific Connection object. The next timewe
    want
    to use the same query we get a Connection from the pool, which
    might
    be
    another instance of the Connection class. Therefor it seemsimpossible
    or at
    least dangerous to reuse the same prepared statement. Even in the
    case
    this
    would work we're indirectly using the other Connection, which we
    already
    returned to the pool and which could be retrieved from the pool bysomeone
    else. So, can't we reuse preparedstatements ?We already have you covered! Weblogic caches PreparedStatements along
    with the pooled connection they came from. Every time you obtain a
    pool
    connection and run a prepareStatement() or prepareCall(), we willtransparently
    give you a previously made statement, if the SQL exactly matches, andno
    other place in the current thread stack is using that statement(multiples
    can
    be cached)
    You are correct, of course, that statements you have should only
    be
    useable
    to you while you have the connection from which they came. We have
    you
    covered
    there too. If you were to try to use any prepared statement that
    you'd
    gotten
    from
    a pool connection after you'd put the connection back into the pool,those
    statements
    would throw an exception saying that they had been made inoperable atthe
    time
    you'd closed the connection.
    Joe Weinstein at B.E.A.

  • Oracle: slow performance with SELECT using ojdbc14 and connection pooling

    Hello,
    i'm working hard the last days to solve a performance problem with our customer using a oracle 10g database. For testing I used our oracle 9.2.0.1.0 database which shows the same symptoms. All doing solved nothing: the performance while using this oracle is much slower than other databases. This result I cannot trust and so I need some advice. What is missing to improve the performance on the java side?
    The webapplication I use runs fast on MySQL 4.x and SQLServer 2000, but on the above mentioned Oracle it was always 4 times slower. The webapplication uses a lot of simple SELECT-Statements without complicated joins and so on (because it should run on many different databases). Doing some days of creating tests within this webapplication, I was not able to find any entrance point for a change. All databases server I'm using, having only the default configurations after a common installation.
    To reduce the complexity I wrote a simple java application with connection pooling using only the latest libraries from apache-commons(dbcp, pool), and the latest ojdbc14 for oracle 9.2.
    First the results than the code: MySQL needed less than 1000 millisecond, SQLServer around 1000 milliseconds and Oracle over 2000 milliseconds. I stopped pooling and the results are for Oracle even worse: over 18000 milliseconds (mysql:2500, sqlserver:4100).
    I changed the classes for Oracle and used the class oracle.jdbc.pool.OracleConnectionCacheImpl from the ojdbc14-library. No difference (around 100 milliseconds more or less).
    The only Select-Statement works on this table, which has one index on HICTGID.
    It contains 259 entrances.:
    CREATE TABLE HIERARCHYCATEGORY (
      HICTGID                 NUMBER (19)   NOT NULL,
      HICTGLEVEL              NUMBER (10)   NOT NULL,
      HICTGEXTID              NUMBER (19)   NOT NULL,
      HICTGEXTPARENTID        NUMBER (19)   NOT NULL,
      HICTGNAME               VARCHAR2(255) NOT NULL
    );The application simply loops through this table using
    SELECT Hictgid, Hictgname FROM HIERARCHYCATEGORY WHERE HICTGID = ?, but I always open a connection before this query and closes this connection afterwards. So I use the pooling as much as possible. That's all SQL I'm using.
        protected static DataSource setupDataSource(String sDriver, String sUrl, String sUser, String sPwd) throws SQLException {
            BasicDataSource ds = new BasicDataSource();
            ds.setDriverClassName(sDriver);
            ds.setUsername(sUser);
            ds.setPassword(sPwd);
            ds.setUrl(sUrl);
            // The maximum number of active connections:
            ds.setMaxActive(3);
            // The maximum number of active connections that can remain idle in the pool,
            // without extra ones being released, or zero for no limit:
            ds.setMaxIdle(3);
            // The maximum number of milliseconds that the pool will wait (when there are no available connections)
            // for a connection to be returned before throwing an exception, or -1 to wait indefinitely:
            ds.setMaxWait(3000);    
            return ds;
        }I can switch by using external properties between three databases (oracle, mysql and sqlserver) and if I want I can switch pooling off. And all actions I'm interested are logged by Log4J.
        public static Connection getConnection() throws SQLException {
            Connection result = null;
            String sJdbcDriver = m_oJbProp.getString("jdbcDriver");
            String sJdbcUrl = m_oJbProp.getString("databaseConnection");
            String sJdbcUser = m_oJbProp.getString("dbUsername");
            String sJdbcPwd = m_oJbProp.getString("dbPassword");
                try {
                    if (m_oJbProp.getString("useConnectionPooling").equals("true")) {
                         if (log.isDebugEnabled()) {
                              log.debug("ConnectionPooling true");
                        if(null == m_ds) {
                            m_ds = setupDataSource(sJdbcDriver,sJdbcUrl,sJdbcUser,sJdbcPwd);
                              if (log.isDebugEnabled()) {
                                   log.debug("DataSource created");
                        result = m_ds.getConnection();
                    } else {
                        // No connection pooling:
                         if (log.isDebugEnabled()) {
                              log.debug("ConnectionPooling false");
                        try {
                            Class.forName(sJdbcDriver);
                            result = DriverManager.getConnection(sJdbcUrl, sJdbcUser, sJdbcPwd);
                        } catch (ClassNotFoundException cnf) {
                            log.error("Exception: Class Not Found. ", cnf);
                            System.exit(0);
    (.. ErrorHandling ...)Here is the code fragment which is doing the work:
                     StringBuffer sb = new StringBuffer();
                while (lNextBottom <= lNextCeiling) {
                     con = getConnection();
                     innerSelStmt = con.prepareStatement("SELECT Hictgid, Hictgname FROM HIERARCHYCATEGORY WHERE HICTGID = ?");
                     innerSelStmt.setLong(1, lNextBottom);
                     rsInner = innerSelStmt.executeQuery();
                     if ((rsInner != null) && (rsInner.next())) {
                         sb.append(rsInner.getLong(1) + ", " + rsInner.getString(2) + "\r");
                          if (log.isDebugEnabled()) {
                               log.debug("Inner Statement: " + rsInner.getLong(1) + "\r");
                     rsInner.close();
                     con.close();
                     lNextBottom++;
                 if (log.isInfoEnabled()) {
                      log.info("\rResult values: Hictgid, Hictgname \r");
                      log.info(sb.toString());
                 }and the main method:
        public static void main(String[] args) {
            try {
                 long lStartTime = System.currentTimeMillis();
                 JdbcBasic oJb = new JdbcBasic();
                 boolean bSuccess = false;
                 bSuccess = oJb.getHierarchycategories();
                 if (log.isInfoEnabled()) {
                      log.info("Running time: " + (System.currentTimeMillis() - lStartTime));
                 if (null != m_ds) {
                     printDataSourceStats(m_ds);
                      shutdownDataSource(m_ds);
                      if (log.isInfoEnabled()) {
                           log.info("Datasource closed.");
             } catch (SQLException sqe) {
                  log.error("SQLException within  main-method", sqe);
        }My database values are
    databaseConnection=jdbc:oracle:thin:@SERVERDB:1521:ora
    jdbcDriver=oracle.jdbc.driver.OracleDriver
    databaseConnection=jdbc:jtds:sqlserver://SERVERDB:1433/testdb
    jdbcDriver=net.sourceforge.jtds.jdbc.Driver
    databaseConnection=jdbc:mysql://localhost/testdb
    jdbcDriver=com.mysql.jdbc.Driver
    dbUsername=testusr
    dbPassword=testpwdThanks for your reading and maybe for your help.

    A few comments.
    There is of course another difference between your test cases then just the database. There is also the driver. And I suspect that in at least the case with the jtds driver it is helping you along where you are doing something silly and the Oracle driver is not.
    Before I explain the next part I would say the speed differences between MS-SQL and MySQL look about right I think you are aiming here for MS-SQL level performance not MySQL. (For a bunch of reasons MySQL is inherently faster but there are MANY drawbacks as well which have been well discussed on previous threads)
    Here is where I believe your problem lies
    while (lNextBottom <= lNextCeiling) {
                     con = getConnection();
                     innerSelStmt = con.prepareStatement("SELECT Hictgid, Hictgname FROM HIERARCHYCATEGORY WHERE HICTGID = ?");
                     innerSelStmt.setLong(1, lNextBottom);
                     rsInner = innerSelStmt.executeQuery();
                     if ((rsInner != null) && (rsInner.next())) {
                         sb.append(rsInner.getLong(1) + ", " + rsInner.getString(2) + "\r");
                          if (log.isDebugEnabled()) {
                               log.debug("Inner Statement: " + rsInner.getLong(1) + "\r");
                     rsInner.close();
                     con.close();
                     lNextBottom++;
                 }There at least four things that are wrong with above.
    1) Why are you preparing the statement INSIDE the loop. Let us for a moment say that the loop will spin 100 times. That means that you are preparing the same statement 100 times. This is bad. It is also very relevant because for example the Jtds driver is going to be caching the prepared statements you make so that actually while you try and prepare it 100 times it only actually does it once... but in Oracle I don't know what it is doing for sure but if it is preparing on each pass well than that bit of it is going take 100 times longer then it should.
    2) You are opening and closing the connection on each pass through the loop... also a terrible idea. You need to fix this first so that you can repeatedly use the same prepared statement.
    3) Why are you looping in the first place? More on this later.
    4) Where do you close the PreparedStatement? It doesn't look like you do.
    Okay so for starters your loop should look a lot more like this...
    code]
    con = getConnection();
    innerSelStmt = con.prepareStatement("SELECT Hictgid, Hictgname FROM HIERARCHYCATEGORY WHERE HICTGID = ?");
    while (lNextBottom <= lNextCeiling) {
    innerSelStmt.setLong(1, lNextBottom);
    rsInner = innerSelStmt.executeQuery();
    if ((rsInner != null) && (rsInner.next())) {
    sb.append(rsInner.getLong(1) + ", " + rsInner.getString(2) + "\r");
    rsInner.close();
    lNextBottom++;
    innerSelStmt.close();
    con.close();
    I think the code above (and you can put your debug stuff back if you want) which uses ONE connection and ONE prepared Statement will improve your performance dramatically.
    The other question though I would as is why in the hell you are doing 100 or whatever number of queries anyway. This can be done all in ONE query which again will improve performance.
    Your query and such should look like this I think.
    String sql = "SELECT Hictgid, Hictgname FROM HIERARCHYCATEGORY WHERE HICTGID >=? AND HICTGID<=?";
    PreparedStatement ps = conn.prepareStatement(sql);
    ps.setLong(1,lNextBottom );
    ps.setLong(2,lNextCeiling);
    ResultSet rs = ps.executeQuery();
    while(rs.next()){
      // your appending to string buffer code goes here
    }and I can't understand why you're not doing that in the first place.

  • SessionCookie and Connection pooling

    hi,
    we use BC4J with connection pooling enable and we have some misunderstandings ... We have chosen a navigation through our web application through wizards ...
    We only enter data in the database at the end of the wizard so we have chosen to use the release mode stateful for our BC4J aplication module.
    After one page, in a struts action, we create a Row of a ViewObject ... and in the second page, we want to retrieve the row created ... but we can't... the application module that we get seems to be another.
    Is it a normal behavior ?
    How do we get the instance of application module we have instantiated at the beginning of the wizard ? Is it a problem with the connection pooling ?
    Some detail: we use a class HttpContainer to get our application module instance ? Are we wrong ? should we get these instance directly from the PoolManager ?
    Tanx for any comment.

    i would ignore the idea all together, unlessyour
    connection has state or something, here readthis:
    http://nikhilb020875.wordpress.com/2006/05/24/cache-vs
    -pool/Hard to say for sure but I would guess your response
    is meaningless. It certainly isn't clear to me why
    you think that link is relevant.if you had read the first 2 lines from the page..I read the entire link.

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

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

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

  • Create and Apply new connection pool failure

    Hi all,
    I am trying to creat a new connection pool by the examples Console with WebServer
    6.0
    Name: testingPool
    URL: jdbc:cloudscape:demo or jdbc:dbc:cloudscape:Test (where Test is a new DB
    in cloudscape)
    Driver Name:COM.cloudscape.core.JDBCDriver
    Property:
    user=none
    password=none
    server=none
    Then create a Datasource which using the new created testingPool and the Target
    is the "exampleServer"
    However when I start the server,it keeps on complaining that the "testingPool
    is not exist".
    Any setting that I 've missed when using a new connection pool??
    I only know the workaround is using the demoPool which is already exist in the
    example.
    Any help will be very appreciate!!
    Thanks !
    Regards,
    u0p1

    HI,
    I've already set the Target Server to be the Example Server,
    is it wrong?
    "Sree Bodapati" <[email protected]> wrote:
    Check if you have set a target server for the connection pool.
    sree
    "u0p1" <[email protected]> wrote in message
    news:3bb3bc32$[email protected]..
    Hi all,
    I am trying to creat a new connection pool by the examples Consolewith
    WebServer
    6.0
    Name: testingPool
    URL: jdbc:cloudscape:demo or jdbc:dbc:cloudscape:Test (where Test isa new
    DB
    in cloudscape)
    Driver Name:COM.cloudscape.core.JDBCDriver
    Property:
    user=none
    password=none
    server=none
    Then create a Datasource which using the new created testingPool andthe
    Target
    is the "exampleServer"
    However when I start the server,it keeps on complaining that the"testingPool
    is not exist".
    Any setting that I 've missed when using a new connection pool??
    I only know the workaround is using the demoPool which is already existin
    the
    example.
    Any help will be very appreciate!!
    Thanks !
    Regards,
    u0p1

  • Difference between using app server connection pooling and using the driver

    Hi all,
    How to get connection pooling with out application server and tomcat also?
    What is the difference between using app server connection pooling and using the driver supported connection pooling?
    Regards,
    Murali

    maybe the performance of App server pool is better than the JDBC pool,
    for you don't know wether the implementation of the JDBC interface is good or bad.

  • Connection pool and Connection factory difference?

    Hi,
    Can someone clarify the difference between connection pool and connection factory.
    I know connection pool is some thing like a pool of database connection manitained at one place so that an application or client can use it when it requires.
    Then wat exactly is connection factory..say in 10g we always put a connection factory name in all adapters and acces the data sources like DB ,FTP,AQ ..etc
    can someone clarify??
    regards,

    To conserve system resources and to improve the performance of transactional applications, WebLogic allows you to define a pool of client connections (generally database but may be a FTP,FILE etc. as well)
    A Connection Factory object encapsulates a set of connection configuration parameters that has been defined by an administrator. A client uses it to create a connection with a service provider (generally JMS).
    Regards,
    Anuj

  • Difference between connection pooling and simple connection

    Anybody please tell me what is the Difference between connection pooling and simple connection and also where we define connection pooling and how.
    Thanks
    Please reply soon
    amitindia

    Creating and closing connection to the database is a relatively slow process. Equally connections use database resources so you can't just open as many as you want.
    A connection pool maintains a number of open connections throughout the lifetime of the application. Instead of opening and closing the connections your application just "borrows" them from the pool when they're needed.
    If the pool runs out of connections it will usually create new ones as needed until you reach some predefined upper limit.
    A good connection pool will also manage connections which have failed for any reason, and report code which fails to return connections to the pool (ie connection leaks).
    The number of connections created at startup is referred to as the "low water mark" and the maximum number that the pool will allow to be opened at any given time is the "high water mark". If no connections are available client code will generally block until one is released.
    If by "defined" you mean where can you get a working implementation then your database or application server vendor is likely to provide one. Also the Apache Jakarta Commons includes [url http://jakarta.apache.org/commons/dbcp/]an implementation which you can use with any JDBC driver.
    Dave.

  • Is connection pooling and sharing available on Oracle 9i RDBMS ?

    Hello,
    I would like to connect from oracle to sql server through db link and ODBC (Heterogenous connectivity). But every session in oracle launch session in sql server. Is it possible to have connection pooling and sharing from Oracle RDBMS level ? I need one solution : when (for example) i run 100 sessions in Oracle i would like to see 10 sessions on sql server. I would like remain 90 sessions from oracle to be queued.
    I would mention that i was using Heterogenous connectivity with multithreading agent (agtctl) without success.
    appreciate any help :-)

    There are two concepts you could evaluate, but they are mainly used for connections to the database, not to sqlserver, but if you can make them work with heterogeneous connectivity this could help:
    Connection Pooling. When many sessions are connecting to the same database, it could be that some of them remain idle. Oracle can detect them and timed them out letting another session to enter into the database, letting the idle session remain open without closing its session. This is configured by means of the shared server architecture.
    Session Multiplexing. Session multiplexing allows the same bandwidth to be used by many sessions at the same time, this enables the server to use fewer network connection endpoints for incoming request. In order for you to configure session multiplexing you have to configure connection manager.
    Ref. Oracle® Database Net Services Administrator's Guide
    10g Release 2 (10.2)
    Part Number B14212-02
    ~ Madrid
    http://hrivera99.blogspot.com/

  • Replace Quotes, Connection Pooling, and Sun Web Server with MySQL, Oracle

    This is code I use to insert data into my MySQL and Oracle databases.
    I takes care of quotes and shows use of context, i.e. when you use Sun Web Server's
    ConnectionPooling. This code works. Feel free to reply if you have questions on how to set up connection pooling using Sun Web Server 6.1SP - it took quite a long time to learn and I couldn't find much information throughout the web, so I hope this helps...
    This is not a question and I am not looking for an answer, but please post comments or suggestions.
    dailysun
    This is in one class where I have a hashtable containing the
    column name / value pairs that I want to enter into my table.
    This class simply creates the SQL string from the values in the
    hashtable. It then passes that hashtable including the database
    name to a class which executes that sql statement (second code
    portion).
    /* Insert data into sf_parts. Create the column strings from
             * the provided hash table. Be sure to parse out hash elements which
             * are used for the createTemplate process
            StringBuffer values = new StringBuffer();
            StringBuffer fields = new StringBuffer();
            Enumeration keys = fieldHash.keys();
            while(keys.hasMoreElements()){
                Object currentKey = keys.nextElement();
                    String fieldValue = (String) fieldHash.get(currentKey);
                    if(values.length() >0){
                        values.append(",");
                    values.append("'"+fieldValue.replaceAll("'","''")+"'"); // Takes care of quotes and various other special characters!
                    if(fields.length() >0){
                        fields.append(",");
                    fields.append(currentKey);
            sql = "INSERT INTO myTable (" + fields.toString() + ") VALUES (" + values.toString() + ");";
            String insertResult = caq.getInsertDelete(sql,"myDatabaseName"); // your database name is defined in web.xml and sun-web.xml when you use Sun Web Server's Connection Pooling.
            returnValue += "<br><br><b>Rows inserted into table(myTable): </b>" + insertResult + "<br>\n";
            And, like I describe above, this method executes the sql statement.
         * Takes care of insert, update and delete requests.
         * Must have set both dbName as well as the sql String.
         * Will return number of rows affected as String.
         * @return String Number of rows affected
         * @exception SQLException
         * @exception Exception
        public String getInsertDelete() {
            checkData(); // this simply checks if the variables dbName and sql are not empty ;-)
            InitialContext initContext = null;
            int rv = 0;
            try{
                // Get connection from configured pool
                initContext = new InitialContext();
                source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName); // I have this set up in web.xml and sun-web.xml (I use Sun Web Server 6.1SP which does connection pooling for me)
                conn = source.getConnection();
                if(conn != null){
                    stmt = conn.createStatement();
                    rv = stmt.executeUpdate(sql);
            }catch (SQLException e){
                // do something
            }catch (Exception e){
                // do something
            }finally{
                try{
                    stmt.close();
                }catch(Exception e){
                    // do something
                try{
                    conn.close();
                }catch(Exception e){
                    // do something
                try{
                    initContext.close();
                }catch(Exception e){
                    // do something
            return rv+"";
        }  

    This is code I use to insert data into my MySQL and
    Oracle databases.
    I takes care of quotes and shows use of context, i.e.
    when you use Sun Web Server's
    ConnectionPooling. This code works. Feel free to
    reply if you have questions on how to set up
    connection pooling using Sun Web Server 6.1SP - it
    took quite a long time to learn and I couldn't find
    much information throughout the web, so I hope this
    helps...
    This is not a question and I am not looking for an
    answer, but please post comments or suggestions.Using prepared statements would mean that you wouldn't have to worry about quotes.
    You should be closing the result set.
    You are handling all fields as strings. That won't work with time fields and might not work for numeric fields.
    Presumably most of your variables are member variables. They should be local variables because that is the scope of the usage.
    You must do something with the exceptions.
    Hashtables although convienent mean that problems with usage can only be resolved at run time rather than compile time.

Maybe you are looking for

  • UPS and Surge Protection

    I just purchased a Mac Pro 3 gHz Tower and I would like to properly protect my tower as well as 30" mac cinema display, external harddrive, and cable modem line. If my power did go out, I would just need several minutes to save and close the machine.

  • How do i create a mail box in the SMTP server thru a java program

    How do i create a mail box in the SMTP server thru a java program. If it is possible thru a java program.pls suggest a mail server compatible for the above possibility to work. pls help ....

  • Cannot connect to server since upgrade to 31.6. Cannot create a new account either.

    Tried to change port settings, but that did not work. Chatted with comcast, but they couldn't fix the problem. Made it worse by suggesting that I delete old account and reestablish a new one. Deleting old account made it worse by removing my large in

  • How to Upgrade PHP 5.3.6 to 5.3.7

    I've been advise by GoDaddys Web Scan Security product to upgrade my current PHP version 5.3.6 to version 5.3.7 as the newer version fixed some security issues.  I'm running Mac OS X Server 10.6.8 on a MacMini.  I've been Googling around and can't fi

  • How can I change the problem on my Ipad's repair status?

    Hello, Actually, I found some problem with my Ipad, so I requested the repair service, but after I filled out the form and summitted, I noticed that my Ipad has another problem regardless of the first problem that I mentioned. If then, how can I let