Pooling PreparedStatement s- Connection Pooling in a Servlet-Applicatrion

We are using OC4J (Servlets) and Oracle9i.
In the application I use Connection Pooling with
datasource.xml.
It works fine.
Is it possible to create a pool of PreparedStatements and "connect" them with the connections in the pool?
Has anyone an idea how to do it or an example?
Thanks in advance
Peter

It's not necessarily "bad" as in "it won't work". I personally wouldn't do it because it's poor design. Now, if this is just a small, trivial app. then you have to decide if abstracting things more is worth it. It's not following best practices to put JDBC calls in your servlet. Your servlet should sit there and direct traffic to appropriate handlers, acting as a controller.
At a minimum I would put the JDBC stuff in its own class and have the servlet use that class.
Even if you keep your JDBC stuff in your servlet, you really should reuse a common set of DB connections instead of creating a new one each time.

Similar Messages

  • Connection Pool problems with Weblogic SP4 & Toplink 9.0.4.5

    Hi,
    i have updated my Weblogic 8.1 from SP2 to SP4. Since that I always get the following exception:
    Hi,
    i have updated my Weblogic 8.1 from SP2 to Sp4. Since that I always get the following exception:
    Exception [TOPLINK-4002] (TopLink (WLS CMP) - 10g (9.0.4.5) (Build 040930)): oracle.toplink.exceptions.DatabaseException
    Exception-Beschreibung: java.sql.SQLException: Pool connect failed : javax.security.auth.login.FailedLoginException: [Securit
    y:090304]Authentication Failed: User javax.security.auth.login.LoginException: [Security:090301]Password Not Supplied
    This exception is thrown when the StartUp-Servlet tries the first time to establish an connection to my Connection Pool. The connection pool itself has been tested in the Weblogic-console and works fine.
    Thanks for help.

    Sebastian,
    9.0.4.5 is the version with fixes to address changes made by BEA in SP4 so this should work. I do recall some issue with our login configuration and the data source.
    Is the user-name specified in either your sessions configuration of project XML without a password. This may be an issue where if part of the credentials are supplied it is asking for the rest.
    Doug

  • [原创] 有关Weblogic Connection Pool 连接恢复的问题

    这是一个古老的问题,一直困扰我,这里既然碰到了,就看看能不能解决。
    环境描述:
    WEBLOGIC版本是8.1 SP2,数据库是SQL SERVER 2000,分别部署在两个服务器上。
    第一步:
    问题描述:
    数据库服务器重新启动,导致WEBLOGIC 的CONNECTION POOL中的连接中断,EJB无法获得连接,导致应用出错。
    解决方法:
    进入WEBLOGIC ADMIN CONSOLE,
    Services->JDBC->Connection Pools->Config->Connections, 点开Advanced Options.
    打开 Test Reserved Connections ,Test Created Connections,Test Released Connections这三个选项。
    将Test Table Name属性设置为:sysproperties(SQL Server系统表,即使自己的应用不存在,这个表也存在,而且默认的内部没有数据)
    根据如下解释:
    Connections that fail the test are closed and reopened to re-establish a valid physical database connection.
    (You must specify a Test Table Name below.)
    每次调用首先进行测试连接,如果测试失败连接将重新建立。
    测试结果:
    WEBLOGIC启动后,关闭数据库SQL SERVER,应用服务器前端调用此时失败。
    重新启动SQL SERVER后,WEBLOGIC端略做等待,前端应用恢复正常。
    第二步:
    问题描述:
    进一步测试,如果WEBLOGIC先启动,启动完成后再启动数据库。
    在WEBLOGIC CONSOLE得到如下输出:
    <2006-3-22 上午11时50分08秒 GMT+08:00> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for p
    ool "MyJDBC Connection Pool": [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.>
    <2006-3-22 上午11时50分10秒 GMT+08:00> <Error> <JDBC> <BEA-001150> <Connection Pool "MyJDBC Connection Pool" deployment
    failed with the following error: 0:Could not create pool connection. The DBMS driver exception was: [Microsoft][SQLServe
    r 2000 Driver for JDBC]Error establishing socket..>
    <2006-3-22 上午11时50分10秒 GMT+08:00> <Error> <JDBC> <BEA-001151> <Data Source "MyJDBC Data Source" deployment failed w
    ith the following error: DataSource(jdbc/OMSEIITxDS) can't be created with non-existent Pool (connection or multi) (MyJD
    BC Connection Pool).>
    Unable to deploy EJB: XXXXXXX from XXXXXXX.jar:
    [EJB:011028]The DataSource with the JNDI name: jdbc/XXXXXX could not be located. Please ensure that the DataSource h
    as been deployed successfully and that the JNDI name in your EJB Deployment descriptor is correct.
    1、在默认初始化打开的连接一一失败以后,连接池发现可用的连接为0,郁闷的宣布自己部署失败。
    2、接着数据源发现没有可用的连接池,自己也宣布部署失败。
    3、下面所有的EJB发现不了数据源的JNDI名,部署也全部失败。
    应用启动完成后,大部分EJB的状态为INACTIVE。前端应用无法使用,此时启动数据库,前端应用无法使用。
    手动重新部署 EJB失败,错误还是找不到JNDI,前端应用无法使用。
    手动重新部署 连接池,数据源后,部署EJB 依然失败。前端应用无法使用。
    解决方法:
    进入WEBLOGIC ADMIN CONSOLE,
    Services->JDBC->Connection Pools->Config->Connections, 点开Advanced Options.

    Connection Creation Retry Frequency 参数设置为 60。
    ConnectionCreationRetryFrequencySeconds含义:
    当创建数据库连接时,如果数据库不可用(如数据库没启动),隔多长时间试着重新创建该连接,
    WLS8.1会每隔ConnectionCreationRetryFrequencySeconds秒重试一次.直到JDBC POOL创建成功
    参考:http://dev2dev.bea.com.cn/techdoc/20030469.html,‘JDBC Connect Pool’部分。
    英文解释可以直接控制台上看到,或者edocs查。
    测试结果:
    将数据库关闭,WEBLOGIC重新启动。
    在WEBLOGIC CONSOLE得到如下输出:
    打开Connection Creation Retry Frequency 参数后,连接池在第一轮尝试失败以后,就成功部署了,数据源也成功部署。
    EJB部署会失败,但是提示也与先前的不同:
    Unable to deploy EJB: XXXXXXX from XXXXXXX.jar:
    weblogic.common.resourcepool.ResourceLimitException: No resources currently available in pool MyJDBC Connection Pool to
    allocate to applications, please increase the size of the pool and retry..
    每隔一段时间会看到,CONNECTION POOL不断的重新进行连接:
    <2006-3-22 下午12时17分56秒 GMT+08:00> <Warning> <JDBC> <BEA-001129> <Received exception while creating connection for p
    ool "MyJDBC Connection Pool": [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.>
    在WEBLOGIC启动完成后,所有EJB为INACTIVE状态。
    启动数据库服务器,稍后,手动重新部署所有的EJB,EJB可以部署成功,前端应用可以正常使用。
    此时,此问题已经基本解决,仍需要手动部署EJB。
    第三步:
    问题描述:
    解决方法:
    有关部署次序的问题,首先查阅WEBLOGIC文档,http://edocs.bea.com/wls/docs81/faq/deploy.html#744900,得到
    WebLogic Server deploys server-level resources (first JDBC and then JMS) before deploying applications.
    Applications are deployed in this order: connectors, then EJBs, then Web Applications.
    If the application is an EAR, the individual components are loaded in the order in which they are declared
    in the application.xml deployment descriptor.
    WEBLOGIC先部署服务器端资源,JDBC -> JMS....,然后部署我们的应用,EJB->WEB APPLICATION。
    实际从WEBLOGIC启动日志来看,即使打开了Connection Creation Retry Frequency,如果当时数据库不是可用的,CONNECTION POOL
    会不断的调度CONNECTION进行重新连接。但是此时,EJB的部署也同时在进行。个人猜测这应该是两个不同的线程(组)分别调度的任务。
    现在考虑的是能不能用StartupClass截住EJB的部署过程,粗略的说是如果DATASOURCE没有连接好,或者没有可用的连接池,
    就不往下进行EJB部署的过程。
    参考:http://edocs.bea.com/wls/docs81/config_xml/EJBComponent.html#DeploymentOrder
    DeploymentOrder:
    A priority that the server uses to determine when it deploys an item. The priority is relative to other deployable
    items of the same type. For example, the server prioritizes and deploys all EJBs before it prioritizes and
    deploys startup classes.Items with the lowest Deployment Order value are deployed first.
    There is no guarantee on the order of deployments with equal Deployment Order values.
    There is no guarantee of ordering across clusters. Default: 1000 Minimum: 0 Maximum: 2N31-1
    在部署同一类应用时,按照 DEPLOYMENT LOADER的数值决定,数值越小越先。(EJB的参数在ADMIN CONSOLE界面上叫做LOAD ORDER)
    而且上面看来服务器是先部署EJB,再部署STARTUP CLASS,遗憾了。
    好在STARTUP CLASS上有两个选项,
    Run Before Application Deployments
    Run Before Application Activations
    这两个选项分别可以设置StartupClass分别在系统资源部署之前,以及在系统资源部署和用户应用部署之间启动。
    选上Run Before Application Activations。
    现在可以了,我写了一个STARTUP CLASS,思路见下:
    主代码:
    private void testConnection(){
    while (!isTimeout() && !getConnection()){
    try{
    Thread.sleep(testInterval*1000);
    }catch(Exception ignor){}
    log("DBConnectHolder job finished with following status:");
    log("Timeout:"+isTimeout +",Connection OK:"+isConnected);
    测试结果:
    只要配置的等待时间足够长,应用服务器先行启动的情况下,等待数据库启动后才进行EJB等等的部署。
    (主要考虑如果数据库连接不OK,EJB启动了也没有太大用,还得手工重新部署。)算是比较完满的解决了问题。
    另外一个思路是是否可行? 通过MBean, 在CONNECTION 建立起来以后通知一把,进行EJB的重新部署。
    没来得及研究,请有经验的同学帮我补充完善。
    结论:
    其实也没什么结论,只是把自己遇到问题,解决问题的思路写了一下。短时间内阅读的文献有限,可能采用了一些苯方法
    ,或者走了弯路,也请大家拍砖。
    在WL8版本上,数据库连接进行恢复和重新连接的时候,上面提出的几个参数应该是比较重要的,我再次强调一下。
    Services->JDBC->Connection Pools->Config->Connections, 点开Advanced Options.
    Test Reserved Connections
    Test Created Connections
    Test Released Connections
    Test Table Name
    Connection Creation Retry Frequency

    在第一个情景中应该只需要打开Test Reserved Connections 就可以了。
    Test Created Connections表示创建连接后放到pool之前进行测试看连接是否可用
    Test Released Connections表示释放连接回到pool之前进行测试看连接是否可用
    I think so!

  • Connection Pooling Questions

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

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

  • Physical Tables from multiple connection pools

    Hi all,
    we have in our RPD file two connection pools (let's say A and B), each connecting to a different source DBs.
    Thus, each physical table resides either in source DB A or B (xor).
    The specified connections work in Admin tool, and also direct database requests work in OBIEE 11G if we explicitly
    provide the correct connection pool. The connection pools are specified in order A,B in the Admin tool.
    However, using OBIEE answers always results in following error message if data from the connection pool B
    is to be queried:
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000]
    [nQSError: 10058] A general error has occurred.
    [nQSError: 43113] Message returned from OBIS.
    [nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist at OCI call OCIStmtExecute.
    [nQSError: 17010] SQL statement preparation failed. (HY000)
    If we exchange the order of connection pools to B,A in Admin tool, we get the same error if we query
    data from connection pool A.
    It seems that each connection pool needs to be able to access all physical tables. Is that correct?
    Thanks, Thomas
    Edited by: user13376481 on Mar 4, 2013 3:08 AM

    Hi Thomas.
    I have the same escenario...
    you tried the solution? worked?
    Thanks.
    Hamilton T

  • Connection Pool Metrics in ASC - doesn't seem to reflect the usage

    Guys,
    So i am trying to monitor the jdbc connection pool usage using the Application server Console (following the link --> Cluster Topology > Application Server: engas-machine > OC4J: oc4jinstance > JDBC Resources > Connection Pool Metrics: "myconnectionpool"
    But i don't see the Pool Usage not reflecting any change and displaying the value 0 for all attributes as below
         Connections In Use     0          
         Free Connections          0          
         Total Connections in Pool          0          
         Threads Waiting for Connections     0
    I wonder why is that, i wonder if i have to use ojdbc-dms driver for the ASC to display the actual statistics ?
    Thanks in advance

    BTW. here is the data-source.xml file...
    <data-sources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/data-sources-10_1.xsd" schema-major-version="10" schema-minor-version="1">
    <managed-data-source connection-pool-name="MyAppConnectionPool" jndi-name="jdbc/mydb" name="mydatasource"/>
    <connection-pool name="MyAppConnectionPool" initial-limit="20" max-connections="100" min-connections="20">
    <connection-factory factory-class="oracle.jdbc.pool.OracleDataSource" user="[username]" password="[password]" url="jdbc:oracle:oci:@mydb" commit-record-table-name=""/>
    </connection-pool>
    </data-sources>
    </connection-pool>
    </data-sources>

  • VARRAY mapping issues using WLS spk2 connection pools

    We have an ongoing issue with VARRAY's and WLS Connection pools. The connection
    pool of WebLogic does not support certain data structures of Oracle such as VARRAY.
    To create array/struct object in java application, we have to register these
    objects through array/struct descriptor methods. These methods require Oracle.sql.Connection
    as a parameter. There is no way to get Oracle.sql.Connection from Weblogic Server
    Connection Pool because the Oracle.sql.Connection is not serializable.
    So, what is the recommended solution for a situation in which the application
    tends to need to use VARRAYs and can we instead pass tables?
    Any recommendations?

    More information on this issue.
    I'm using the method DriverManager.getConnection(URL) to get a connection to
    the database, passing in the name of the connection pool. This method is
    throwing the following SecurityException:
    java.lang.SecurityException: User "john" does not have Permission
    "reserve"
    based on ACL "weblogic.jdbc.connectionPool.ICOM_DEV2_A".
    When running under the LDAP realm:
    -calls to getConnection() from within a jsp fail
    -calls to getConnection() from within a Session Bean or Entity Bean work
    -calls to getConnection() from a non-EJB class fail if it is called directly
    from the jsp
    -calls to getConnection() from a non-EJB class work if it is called from a
    Session Bean
    When running under the RDBMS realm, all calls to getConnection() work,
    whether they are a jsp, non-EJB class or a Session Bean.
    Is there some security context that is only present inside the EJB
    container?

  • Connection Pool hangs

    Hello,
    We have a strange problem with Oracle Connetion pool on IAS 10.1.3.1.0.
    Sometimes (for example once a week, sometimes one a month) connection pool hangs. Enterprise Manager / Connection pool monitor page shows information about threads waiting for connection (see below) and users are unable to work with application.
    Connections In Use                1
    Free Connections                13
    Total Connections in Pool           14
    Threads Waiting for Connections      534
    WebApp installed on IAS is a simple Toplink based application. There are no strange messages in error logs, so why connection pool is unable to assign free connection to user ?
    Thanks in advance
    Tom
    Edited by: olos on Sep 30, 2008 8:57 PM

    Hello,
    Thanks for response. I will try if it is possible to test connection from AS control during next connection pool crash. BTW we must check if this situation is not caused by operation system (Linux) swapping process.
    Regards
    Tom
    My datasources file is:
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <data-sources xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/oracleas/schema/data-sources-10_1.xsd"
    schema-major-version="10" schema-minor-versio
    n="1">
    <managed-data-source connection-pool-name="Example Connection Pool"
    jndi-name="jdbc/OracleDS" name="OracleDS"/>
    <managed-data-source connection-pool-name="Bufor List Connection Pool"
    jndi-name="jdbc/BuforListDS" name="Bufor List Data Source"/>
    <connection-pool name="Example Connection Pool">
    <connection-factory
    factory-class="oracle.jdbc.pool.OracleDataSource" user="scott"
    password="tiger" url="jdbc:oracle:thin:@//localhost:1521/ORCL"/>
    </connection-pool>
    <connection-pool name="PRD Connection Pool"
    abandoned-connection-timeout="120" connection-retry-interval="3"
    max-connect-attempts="5" max-connections="200" min-connections="3"
    property-check-interv
    al="600">
    <connection-factory
    factory-class="oracle.jdbc.pool.OracleDataSource" user="user"
    password="password"
    url="jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=on)(ADDRESS=(PROTOCOL=tcp)(HOST
    =host01)(PORT=1521))(ADDRESS=(PROTOCOL=tcp)(HOST=host02)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=SN.DOMENA.PL)))"/>
    </connection-pool>
    </data-sources>

  • Purpose of  Enable connection pooling

    Hi Gurus,
    What is the purpose of Enable connection pooling in the connection pool of the physical layer.If we gave Enable connection pooling time out as 5 minutes and our report query is taking 1 hr time to execute a report what it will happens weather query will execute or not.
    Thanks,
    Rafi

    Enable Connection Pooling allows a single DB connection to remain open for specified time so that the future query requests could route through the same connection. It saves the overhead of opening and closing new connections and if this option is unchecked then we for each query the DB need to open a new connection.
    Timeout specifies the time for which the connection to data source remains open after the request completes. During this time the new requests make use of this connection instead of opening a new connection. If timeout value set to 0 then connection pooling is disabled.
    your Query will executes,Time out 5 min means if the execution completes with in 5 min then connection will remain open for new Requests,no need to open a new one.
    Mark it if correct
    Edited by: User on Sep 18, 2012 11:57 PM

  • Execute threads used by connection pools

    Hellos,
    I am interested in fining out the relationship betwen the sizes of the execute
    thread pool and a connection pool (jolt in my case).
    I would like to know if each jolt conection uses up a thead from the default execute
    queu or if the threads are taken from a different and reserved thread pool.
    I am trying to tune up the thread pool size according to my pool sizes and so
    on.
    Any ideas?
    Best regards,
    Cristina

    Cristina Ceballos wrote:
    Hellos,
    I am interested in fining out the relationship betwen the sizes of the execute
    thread pool and a connection pool (jolt in my case).
    I would like to know if each jolt conection uses up a thead from the default execute
    queu or if the threads are taken from a different and reserved thread pool.
    I am trying to tune up the thread pool size according to my pool sizes and so
    on.
    Any ideas?Hi. Connection pools do not use threads. Your application thread will get a connection
    from the pool and use it. The relationship between threads and pools is that you want
    to have enough connections in your pool to be able to serve all the threads that
    may individually want a connection. Therefore for a server with 25 execute-threads,
    you would typically define the pool to have 25 connections.
    Joe
    >
    Best regards,
    Cristina

  • Error after resetting connection pool

     

    FYI on the fix--
    I moved back from sp9 to sp8 and the bug went away. Can't wait for sp10...
    --tka
    "tracya" <[email protected]> wrote in message
    news:3b44bdb5$[email protected]..
    I am having a problem with connection pools using 5.1.0, jdk 1.2.2, andthe
    oracle 8.1.7 thin drivers.
    WL starts up fine and will happily service db transactions until I resetthe
    connection pool. The connection pool seems to reset fine, but then all
    future db connections are corrupt. Has anyone else seen anything likethis?
    >
    Thanks!
    I am using the following code to reset the pool:
    Hashtable htEnv = new Hashtable();
    htEnv.put(InitialContext.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");// URL for the WebLogic Server
    htEnv.put(InitialContext.PROVIDER_URL, "t3://localhost:" +
    GetAppServerListenPortNum());
    htEnv.put(InitialContext.SECURITY_PRINCIPAL, sAppUser); //system
    htEnv.put(InitialContext.SECURITY_CREDENTIALS, sAppUserPassword);
    InitialContext icContext = new InitialContext(htEnv);
    JdbcServices jdbc =
    (JdbcServices)icContext.lookup("weblogic.jdbc.JdbcServices");
    jdbc.getPool(sPoolName).reset();
    Here is the code from the props file:
    weblogic.jdbc.connectionPool.DBPool_1=\
    url=jdbc:oracle:thin:@niledev:1521:niledev,\
    driver=oracle.jdbc.driver.OracleDriver,\
    loginDelaySecs=1,\
    initialCapacity=1,\
    maxCapacity=10,\
    capacityIncrement=1,\
    allowShrinking=true,\
    shrinkPeriodMins=15,\
    testTable=DUAL,\
    refreshMinutes=5,\
    testConnsOnReserve=true,\
    props=user=XXXX;password=XXXXX
    weblogic.allow.reserve.weblogic.jdbc.connectionPool.DBPool_1=guest

  • Toplink Mysql Connection pool issues

    I am frequently seeing threads in wait state on toplink connection pool, I have given the stack trace below, anyone has any ideas as to what is happening? is it
    related to connection timeout? or other causes...
    "http-0.0.0.0-8080-2" id=397 idx=0x620 tid=5344 prio=5 alive, in native, waiting
    , daemon
    -- Waiting for notification on: oracle/toplink/threetier/ConnectionPool@0x00
    F181D8[fat lock]
    at jrockit/vm/Threads.waitForNotifySignal(JLjava/lang/Object;)Z(Native Metho
    d)
    at java/lang/Object.wait(J)V(Native Method)[optimized]
    at java/lang/Object.wait(Object.java:474)
    at oracle/toplink/threetier/ConnectionPool.acquireConnection(ConnectionPool.
    java:65)
    ^-- Lock released while waiting: oracle/toplink/threetier/ConnectionPool@0x0
    0F181D8[fat lock]
    at oracle/toplink/threetier/ServerSession.allocateReadConnection(ServerSessi
    on.java:412)
    at oracle/toplink/threetier/ServerSession.executeCall(ServerSession.java:443
    at oracle/toplink/internal/queryframework/DatasourceCallQueryMechanism.execu
    teCall(DatasourceCallQueryMechanism.java:193)
    at oracle/toplink/internal/queryframework/DatasourceCallQueryMechanism.execu
    teCall(DatasourceCallQueryMechanism.java:179)
    at oracle/toplink/internal/queryframework/DatasourceCallQueryMechanism.execu
    teSelectCall(DatasourceCallQueryMechanism.java:250)
    at oracle/toplink/internal/queryframework/DatasourceCallQueryMechanism.selec
    tAllRows(DatasourceCallQueryMechanism.java:583)
    at oracle/toplink/internal/queryframework/ExpressionQueryMechanism.selectAll
    RowsFromTable(ExpressionQueryMechanism.java:2483)
    at oracle/toplink/internal/queryframework/ExpressionQueryMechanism.selectAll
    Rows(ExpressionQueryMechanism.java:2441)
    at oracle/toplink/queryframework/ReadAllQuery.executeObjectLevelReadQuery(Re
    adAllQuery.java:467)
    at oracle/toplink/queryframework/ObjectLevelReadQuery.executeDatabaseQuery(O
    bjectLevelReadQuery.java:874)
    at oracle/toplink/queryframework/DatabaseQuery.execute(DatabaseQuery.java:67
    4)
    at oracle/toplink/queryframework/ObjectLevelReadQuery.execute(ObjectLevelRea
    dQuery.java:835)
    at oracle/toplink/queryframework/ReadAllQuery.execute(ReadAllQuery.java:445)
    at oracle/toplink/internal/sessions/AbstractSession.internalExecuteQuery(Abs
    tractSession.java:2260)
    at oracle/toplink/internal/sessions/AbstractSession.executeQuery(AbstractSes
    sion.java:1074)
    at oracle/toplink/internal/sessions/AbstractSession.executeQuery(AbstractSes
    sion.java:1058)
    at oracle/toplink/internal/sessions/AbstractSession.executeQuery(AbstractSes
    sion.java:1017)
    at com/integral/query/QueryServiceC.executeQuery(QueryServiceC.java:1030)
    at com/integral/query/QueryServiceC._find(QueryServiceC.java:525)
    at com/integral/query/QueryServiceC._findAll(QueryServiceC.java:123)
    at com/integral/query/QueryServiceC.findAll(QueryServiceC.java:83)
    at com/integral/query/ejb/QueryServiceC.findAll(QueryServiceC.java:59)

    Hello,
    It looks like you are using a TopLink managed connection pool and do not have enough connections available for the number of threads needing to use one. This results in threads having to wait until one is released from another thread. In the thread shown, it is waiting to get a read connection from the read pool.
    TopLink connection pools are described in the docs at:
    http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/srvclius002.htm#CHDJAECD
    I'd recommend increasing the min/max number of connections to something that is appropriate to handle your peak load based on your applications usage paterns.
    Best Regards,
    Chris

  • BPEL - Database Connection Pools, JNDI - How do you do it ?

    Scoured forum and BPEL developer and admin guides, and didn't find any good instructions on how to configure and use database pools for BPEL, except possibly this post nearly two years ago data-sources.xml and oc4j-ra.xml
    I suspect things may have changed some in two years ! Where can I find this info. Does anyone who has done it have step by step instructions ?

    You should have scoured better ;-)
    I had a problem that needed to be fixed with a connection pool. Check this post:
    Strange Toplink errors appearing
    It points to some documentation that will help you:
    http://download-uk.oracle.com/docs/cd/B31017_01/integrate.1013/b28994/adptr_db.htm#sthref528
    Basically you have to do the following:
    - look in the WSDL of your DB adapter. It will have a jca:address section. In this section you will see a jndi location, something like: eis/DB/<a_connection>. Make note of this location
    - on the server look for the file oc4j-ra.xml in <oracle_home>/j2ee/<oc4j_soa>/application-deployments/default/DbAdapter. Edit the file. In there are mappings that basically forward the object in location eis/DB/<a_connection> to jdbc/<connection>.
    E.g.:
    <connector-factory location="eis/DB/DBConnection1" connector-name="Database Adapter">
                    <config-property name="xADataSourceName" value="jdbc/DBConnection1DataSource"/>
                    <config-property name="dataSourceName" value="loc/DBConnection1DataSource"/>
                    <config-property name="platformClassName" value="oracle.toplink.platform.database.Oracle9Platform"/>
                    <config-property name="usesNativeSequencing" value="true"/>
                    <config-property name="sequencePreallocationSize" value="50"/>
                    <config-property name="defaultNChar" value="false"/>
                    <config-property name="usesBatchWriting" value="true"/>
                    <connection-pooling use="none">
                    </connection-pooling>
                    <security-config use="none">
                    </security-config>
            </connector-factory>Now copy one of these blocks and edit it so that the location matches your eis/DB/<a_connection> location. Map the dataSource and xaDataSource properties to jdbc/<connection> s (which you create in the next step)
    - go to the enterprise manager, click on the soa suite oc4j container, choose the 'administration' link. Click on the 'Go to task' icon for JDBC connections. Here you can create your connection pool, and db connection. Make sure the location of your JDBC connection matches what you have configured in the oc4j-ra.xml file.
    - restart your soasuite/bpel oc4j container
    - bob's your uncle ;-)
    HTH,
    Bas

  • JDBC20 connect pool issue using OCI driver

     

    I tried to use:
    url=jdbc20:weblogic:oracle.
    driver=weblogic.jdbc20.oci.Driver
    and got the following error:
    <Jul 11, 2001 5:52:34 PM PDT> <Error> <JDBC Connection Pool> <Cannot
    startup connection pool "ExrGlobalDbPool" Cannot load driver class:
    weblogic.jdbc20.oci.Driver>
    "Chuan Li" <[email protected]> wrote in message news:<[email protected]>...
    If you use the driver provided by Oracle, then use the following:
    url=jdbc:oracle:oci8:
    driver=oracle.jdbc.driver.OracleDriver
    "Jeff Guo" <[email protected]> wrote:
    Hi,
    What is the correct way to define the url in the jdbc connection pool
    to
    support jdbc20
    features using Oracle OCI driver?
    Thanks!
    Jeff

  • How to use my connection pool in multiple servlets?

    I now have a functioning connection pool using these lines in a servlet:
    private Connection getConnection(String lookup) throws NamingException, SQLException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(lookup);
    Connection ocon = ds.getConnection();
    context.close();
    return ocon;
    } // private Connection getConnection(String lookup) throws NamingException, SQLException {
    ========================
    If I want to create additional servlets in the same web app which query the same database,
    do I need to repeat this block of code in every servlet, or can I just put it in one servlet
    and have other servlets access it in some way to get a connection? Should I change the code
    above from a "private" Connection to a "public" Connection?
    An example servlet is shown below. To put my question another way: If I want to
    create a second servlet with a different set of queries, would I just make a copy of the first
    servlet and then change only the queries, or is there a more efficient way to have multiple
    servlets get connections from the pool?
    Any suggestions are greatly appreciated.
    Thank you.
    Logan
    ************************************servlet example**********************************
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.Date;
    import java.text.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class CraigsMain extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    private Connection getConnection(String lookup) throws NamingException, SQLException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(lookup);
    Connection ocon = ds.getConnection();
    context.close();
    return ocon;
    } // private Connection getConnection(String lookup) throws NamingException, SQLException {
    // Process the http Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
    try {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String sql = "select formtitle from checkboxforms where cbformid = 157";
    // error occurs at this line
    Connection ocon = getConnection("java:comp/env/jdbc/CraigsList");
    PreparedStatement pStmt = ocon.prepareStatement(sql);
    ResultSet rs1 = pStmt.executeQuery();
    rs1.next();
    out.println("<br>" + rs1.getString(1));
    rs1.close();
    pStmt.close();
    ocon.close();
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException ne) {
    System.err.println("naming exception error: " + ne);
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    =======================================================================

    sjasja, Thank you for the reply. What you are suggesting is exactly what I have been looking for. But I'm pretty weak on how to make this separate con pool servlet work. My first attempt is shown below. It doesn't compile this line, which is obviously wrong:
    public static Connection getConnection(String lookup) throws NamingException, SQLException {
    Could you please help me with this servlet code? Thanks.
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class ConPoolInit extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
    public static Connection getConnection(String lookup) throws NamingException, SQLException {
    Context context = new InitialContext();
    DataSource ds = (DataSource)context.lookup(lookup);
    Connection ocon = ds.getConnection();
    context.close();
    return ocon;
    } // private Connection getConnection(String lookup) throws NamingException, SQLException {
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException ne) {
    System.err.println("naming exception error: " + ne);
    =======================================

Maybe you are looking for

  • How do i create a hyperlink in pages 5.1

    In the past I used the inspector.. Now it's not available. 

  • Business process monitoring - application monitor

    Hi guys Perhaps you can assist.  I have setup a application monitor on SD Invoices AR , sales invoices not posted to FI . It is setup for one sales org and one distribution channel.  It picks up 3 documents.  The monitor runs at night .  When I howev

  • Idoc scripting in workflow tokens

    Greetings, A question for developers: up to what extent of Idoc Script calls can be made inside Workflow tokens? Only the function wfAddUser or other Idoc Script functions as well? I'm trying to develop a dynamic workflow component that involves read

  • Problems with the performance pack for Linux.

    Hi, I have just installed sp9 for WL 5.1 and with it the performance pack. But I get many of these exceptions: Wed Jun 06 15:46:09 EDT 2001:<E> <HTTP> Connection failure java.net.SocketException: Error in poll for fd: '30', revents: '23' at weblogic.

  • 12 Inch PB Battery is Draining - Should I revert to Tiger?

    Hello Everyone, My main computer is a desktop iMac and I continue to use my 12 inch PB as a mobile backup. These days, I use it for web browsing, email and some video (I upgraded to 1.5 GZ). I've noticed when I DON'T have the power plugged in, the ba