BI Publisher not closing connection pool connections?

Hi:
I'm using Oracle WLS 10.3.3, BIP 10.1.3.4.1.
I have reports that were using JDBC data sources defined in BIP and I can run them all day with no problems. I created a JDBC connection pool in the WLS, created a JNDI name for it and then got BIP to recognize the JNDI data source. Finally, I modified the report data template to use the JNDI data source. It all works -- for a time. But after 20 or so executions I get an error that there are no more resources (connections). I went into the WLS and configured "inactive connection timeout" to 15 seconds or so. This eventually gives me another connection but doesn't prevent the lock-up.
Why are the connections no being re-used? I am the only user, it should be using a connection, putting it back into the pool, and then re-using that still open connection for my next query. Is there another setting I need to set in WLS? Do I need to somehow tell the report to close the connection? I wouldn't think the transaction mode for the connection matters, but I could set that as well if I need to.
Thanks.

the reason, i asked you to upgrade the BIP patch
DB CONNECTION IS NOT PROPERLY CLOSED,
BI PUBLISHER NOT CLOSING DB CONNECTIONS USED FOR 'LIST OF VALUES' PARAMETERS
there are few fixes related to Db connection in latest patch.
you can get the latest 10.1.3.4.1 patch for just BIP alone, not OBIEE
I would suggest you to log an SR and prove it to Support.
their first suggestion wud be like mine ;)

Similar Messages

  • Creating Connection Pools/ Connection Pool does not exist error

    Hi everyone -
    I have a question about when/how weblogic creates connections pools.
    Here is the scenario. Sometimes when our weblogic server starts, our
    oracle database is not available. Therefor, weblogic can't create the
    connection pool. However, after oracle comes weblogic up, weblogic
    could create the connection pool, but it doesn't appear to be smart
    enough to do this. Is there a way to ask weblogic to attempt to
    recreate a connection pool?
    We've noticed this behavior on weblogic 6.0 sp2.
    Thanks,
    Scott

    If you define the pool with an initial size of zero, you should be OK. The
    server is currently a little severe with a pool when the server cannot
    create the pool with it's initial capacity, the pool isn't created. The server
    could create it later, if told to via the console or via the admin command line,
    or via the dynamic pool API, but init=0 is easiest.
    Joe
    Scott Gilpin wrote:
    Hi everyone -
    I have a question about when/how weblogic creates connections pools.
    Here is the scenario. Sometimes when our weblogic server starts, our
    oracle database is not available. Therefor, weblogic can't create the
    connection pool. However, after oracle comes weblogic up, weblogic
    could create the connection pool, but it doesn't appear to be smart
    enough to do this. Is there a way to ask weblogic to attempt to
    recreate a connection pool?
    We've noticed this behavior on weblogic 6.0 sp2.
    Thanks,
    Scott

  • Executing commands when connection pool connections created

    Is there any way to set up connection pools to automatically execute a
    command when a connection is created?
    The system I'm working on needs (for a number of reasons outside of our
    control) to switch our connection to be rule based by executing:
    alter session set optimizer_goal=RULE;
    I guess we could add this functionality into our "getConnection" method but
    this just seems kind of inefficient.
    We're using WLS5.1sp11 on solaris2.6 talking to oracle 8.1.7 using
    weblogic.jdbc20.oci.Driver.
    Does anyone have any ideas on how to persuade JDriver to initialise the
    pool with the command above?
    Thanks
    Barry

    Barry Munro wrote:
    Is there any way to set up connection pools to automatically execute a
    command when a connection is created?no, but...
    The system I'm working on needs (for a number of reasons outside of our
    control) to switch our connection to be rule based by executing:
    alter session set optimizer_goal=RULE;
    I guess we could add this functionality into our "getConnection" method but
    this just seems kind of inefficient.
    We're using WLS5.1sp11 on solaris2.6 talking to oracle 8.1.7 using
    weblogic.jdbc20.oci.Driver.
    Does anyone have any ideas on how to persuade JDriver to initialise the
    pool with the command above?One trick you can do is to define the pool's connection test to do this
    every time you reserve a pool connection, instead of doing a query to DUAL or
    whatever test table you define. Define the testTable to be:
    testTable=SQL alter session set optimizer_goal=RULE,\
    testConnsOnReserve=true,\
    Joe
    Thanks
    Barry

  • [原创] 有关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!

  • Freeing connections in a connection pool

    I am using WLS8.1.2 on IA64 with jrockit 8.1.2.
    I have created a connection pool using Microsoft's type 4 non-xa jdbc driver fpr
    SQLServer2000.
    My application performs a number of db operations, then using the retrieved information,
    makes a call to a mainframe and finally makes an insert into the SQLServer. As
    the mainframe call takes a long time, 5-6s and I have many (~1,000) concurrent
    clients, I explicitly close the db connection prior to the call and then re-open
    it for the final insert operation.
    As the initial sql requests take less than 1s, I expected that this approach would
    significantly reduce the number of open connections in the pool, since whilst
    one thread is waiting for 5 seconds, others will be able to use the connection.
    However, from the connection pool monitor, I see that closing the db connection
    has no effect. I have as many open connections as I have threads in the execute
    queue.
    For the connection pool configuration I have enabled shrinking and the "Remove
    Infected Connections Enabled" box is not "ticked".
    Is there anything else that I should do that will return unused connections back
    to the pool?
    Thanks in advance for any advice.
    jez wain

    jez wain wrote:
    Joe Weinstein <[email protected]> wrote:
    Let me see your code. Attached below, with appliction-specific, non-jdbc code removed.Ok. The code looks safe. I assume the DataSource you're accessing is not a
    weblogic transactional DataSource, correct? For instance, if you run this
    code, and before setting autoCommit(false), could you call getAutoCommit()
    and verify that it returns true?
    The reason I ask, is that you are controlling a JDBC transaction on your
    own, just as if you got a plain JDBC connection directly from the DBMS
    driver. However, if you are getting a connection from a transaction-aware
    DataSource, and if this thread is running in the context of a UserTransaction,
    such as in or under a a TX_REQUIRED EJB, then the connection will already be
    autoCommit(false) when you get it, and *when you close or commit the connection
    the connection will cheerfully ignore you until the transaction coordinator
    tells the connection that the tx is really done. If this is the case, then
    you would not be releasing the connection as you thought half-way along
    Joe
    PS: The only suggestion I would have for the code, is that whenever you close
    a JDBC object, you set it to null. And at the end, in the finally, do this:
    // in separate try blocks so a failure in one won't make us skip the next
    if (rs != null) try {rs.close();} catch (Exception ignore){}
    if (ps != null) try {ps.close();} catch (Exception ignore){}
    if (con != null) try {con.close();} catch (Exception ignore){}
    >
    >
    It should be obtaining, using and closing
    a pool connection all within one user invoke. The connection object
    should be a method-level variable so every thread gets it's own.That's what I've done.
    The server has a fixed number of execute threads, so however many
    users are logged in, the server will only be processing that fixed
    number of users at any instant. When one thread is done with a user,
    it closes it's pool connection making it available for the next user
    this thread works for.I understand that. But in my application each thread creates a jdbc connection,
    executes 500ms worth of sql queries, explicitely closes the jdbc connection and
    then effectively sleeps for 5 or 6 seconds waiting for the mainframe. When the
    mainframe replies, it re-opens the jdbc connection, performs another 500ms of
    jdbc updates and then exits.
    My point is that during the 5s waiting for the mainframe, with the jdbc connection
    closed, approx. 5 other threads could use the same connection to perform their
    operations. I would therefore expect that the number of open connections in the
    connection pool to be a little more than one fifth of the number of active threads
    in execute queue. But what I observe is that the number of open connection pool
    connection follows one-for-one the number of active threads.
    Here's the code:
    public class AddItemImpl implements AddItem {
    private static DataSource ds = null;
    private static InitialContext ic = null;
    static {
    try {
    System.out.println("AddItemImpl v1.0");
    ic = new InitialContext();
    ds = (DataSource) ic.lookup(Syetem.getProperty("XXX.datasource"));
    } catch (Exception ex) {
    Syetem.err.println("AddItemImpl Exception: " + ex.getMessage());
    public AddItemResponse addItem(AddItems parameters) {
    AddItemResponse response = null;
    Connection con = null;
    PreparedStatement ps = null;
    ResultSet rs = null;
    try {
    con = ds.getConnection();
    con.setAutoCommit(false);
    AddItemData inputData = parameters.getAddItemData();
    * Check tx id.
    String txId= inputData.getTxId();
    java.sql.Date txDate = null;
    double balance = 0;
    String txState = null;
    ps =
    con.prepareStatement(
    "select balance, state, date from transactions where tx_id= ? ");
    ps.setString(1, txId);
    rs = ps.executeQuery();
    if (!rs.next()) {
    logger.warning("Transaction not found: " + txId);
    con.rollback();
    } else {
    balance = rs.getDouble(1);
    txState = rs.getString(2);
    txDate = rs.getDate(3);
    rs.close();
    ps.close();
    // check data valiidity using with 4
    // more "select" prepared statements
    // in the same style as above
    // checkpoint the state
    int n = 0;
    ps = con.prepareStatement(
    "insert into status tx_id,tx_type,client_id,date,client_data,op_id)
    "+
    "values(?, ?, ?, ?, ?, ?) ");
    ps.setString(1, txId);
    ps.setString(2, txType);
    ps.setInt(3, cleintId);
    ps.setDate(4, currentDate);
    ps.setString(5, clientData);
    ps.setBigDecimal(6, operationId);
    // the operationId poses some uniquenes pb
    // track any errors here
    try {
    n = ps.executeUpdate();
    } catch (SQLException ex) {
    System.err.println(ex.getMessage());
    System.err.println("operationId: " + operationId+ " 0x"+Long.toHexString(operationId));
    ps.close();
    if (n == 0) {
    logger.error("Problem updating status");
    con.rollback();
    } else {
    // commit and close the connection before calling mainframe
    // the mainframe request takes several seconds. Others
    // can use our connection in the meantime
    con.commit();
    con.close();
    Stock stock = getStockFromMainframe(/* mainframe req i/p params */);
    con = ds.getConnection();
    con.setAutoCommit(false);
    // update local instance variables
    // then update tables
    ps = con.prepareStatement(
    "update transactions set balance = ? where tx_id= ? ");
    ps.setDouble(1, balance);
    ps.setString(2, txId);
    n = ps.executeUpdate();
    if (n == 0) {
    logger.error("Problem updating transactions");
    con.rollback();
    } else {
    ps.close();
    ps=con.prepareStatement("update operations set ops_1=ops_1+1,ops_2=ops_2+1"+
    " where tx_id = ? and cod_tx = ? ");
    ps.setString(1, txId);
    ps.setString(2, txType);
    n = ps.executeUpdate();
    if (n == 0) {
    logger.error("Problem updating operations");
    con.rollback();
    } else {
    ps.close();
    // more updates/inserts using the same model as above
    con.commit();
    response = new AddItemResponse(/* AddItemResp constructor params
    }catch (SQLException ex) {
    logger.error("AddItemImpl: " + ex.getMessage());
    ex.printStackTrace(System.err);
    } finally {
    try {
    if (con != null) con.close();
    if (ps != null) ps.close();
    if (rs != null) rs.close();
    } catch (SQLException se) {
    logger.error("AddItemImpl: execption tidying up: " + se.getMessage());
    return response;

  • Repost-Best way of using connection pooling

    I am reposting this, seems best suitable in this category.
    I am using Eclipse 3.1 along with Tomcat 5.0, MySQL 4.1, J2EE1.4. I could set up the JNDI Dataresource connection pooling and tested with small test servlet. Now thinking of having common methods for getting connection / closing / commiting ....etc.
    I wrote following. [Please let me know whether it is correct way of doing it - as i am not very sure]
    package common;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.*;
    import org.apache.log4j.Logger;
    public final class connectionManager {
         private static Logger logger = Logger.getLogger(common.connectionManager.class);
         public connectionManager() {}
         public static Connection getConn () throws NamingException, SQLException
    //JNDI DataSource connection pooling
              Connection conn = null;
              try{
                   Context initContext = new InitialContext();
                   Context envContext  = (Context)initContext.lookup("java:/comp/env");
                   DataSource ds = (DataSource)envContext.lookup("jdbc/TQ3DB");
                   conn = ds.getConnection();
              }catch (NamingException ne) {
                  new GlobalExceptionHandler(logger, ne);
                   conn = null;
                   throw new NamingException();
              }catch (SQLException e){
                   new GlobalExceptionHandler(logger, e);
                   conn = null;
                   throw new SQLException();
              return conn;
           }//getConnection
         public static void commit(Connection conn) throws SQLException
              conn.commit();
         public static void rollback(Connection conn) throws SQLException
              conn.rollback();
           public static void setAutoCommit(Connection conn, boolean autoCommit)
                                        throws SQLException
                conn.setAutoCommit(autoCommit );
         public static void closeConnection(Connection conn) throws SQLException{
              if (conn != null) {
                   conn.close();
                   conn = null;
         }//closeConnection
         public static void closeResources(ResultSet oRS, PreparedStatement pstmt) throws SQLException
              if (oRS != null) {
                   oRS.close();
                   oRS = null;
              if (pstmt != null) {
                        pstmt.close();
                        pstmt = null;
         } // closeResources
    }//ConnectionManager
    I am having a login form which submits user name and password. I am checking this against the database. Following is the servlet to do that.
    package login;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import common.*;
    public class loginServlet extends HttpServlet {
         public void doGet(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {          
              doPost(request, response);
         }//doGet
         public void doPost(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException,IOException{
              String userId = request.getParameter("userId");
              String password = request.getParameter("password");
              ** call a method to validate the password which will return the
              ** User Name for authorized users and null string for un-authorised.
              String uName = validateUser(userId, password);
              //if uName is null .. user is not authorized.
              if (uName == null){
                   //redirect to jsp page with error message
                  RequestDispatcher rd =
                       getServletContext().getRequestDispatcher("/jsps/mainmenu.jsp");
                  if (rd != null){
                       rd.forward(request,response);
              else{
                   // the user is valid - create a seesion for this user.
                   HttpSession userSession = request.getSession(true);
                   // put the user name session variable.
                   userSession.setAttribute("userName", uName);
                   //redirect to Main menu page
                   RequestDispatcher rd =
                        getServletContext().getRequestDispatcher("/jsps/mainmenu.jsp");
                   if (rd != null){
                        rd.forward(request,response);
         }// end of doPost
         private String validateUser(String userId, String password)
                   throws SQLException{
              String returnVal = null;
              connectionManager cm = new connectionManager();
              Connection conn = null;
              PreparedStatement pstmt = null;
              ResultSet oRS = null;
              try{
                   //get the connection
                   conn = cm.getConn ();
                   //get records from user table for this user id and password
                   String sQry = "SELECT  user_login FROM user "
                             + "where user_login = ? AND user_pwd = ? ";
                   pstmt = conn.prepareStatement(sQry);
                   pstmt.setString(1, userId);
                   pstmt.setString(2, password);
                   oRS = pstmt.executeQuery();
                   //check for record
                   if (oRS.next()) {
                        returnVal = oRS.getString("user_login");
                   }else {returnVal = null;}
                 }catch (Exception e){            
                      returnVal = null;
              }finally{
                   cm.closeResources(oRS, pstmt);
                   cm.closeConnection(conn);
              return returnVal;
    }// end of servlet class
    But i am unable to compile it and i am also getting lots of warnings.
    I am getting error at line
    1)String uName = validateUser(userId, password);
    Unhandled exception type SQLException loginServlet.java TQ3/WEB-INF/src/login line
    Following warnings:
    2)For loginServlet Declaration
    The serializable class DBTest does not declare a static final serialVersionUID field of type long loginServlet.java
    3)The static method getConn() from the type connectionManager should be accessed in a static way
    4)The static method closeResources(ResultSet, PreparedStatement) from the type connectionManager should be accessed in a static way
    5)The static method closeConnection(Connection) from the type connectionManager should be accessed in a static way
    Definitely I am doing it wrong but exactly where? I am having very strong doubt the way i am using connections is not the correct way. Pls help me.
    regards
    Manisha

    I am in a search of best way to use connection pooling. Initially was using simple JDBC call, then modified to JNDI, afterwards tried to have common class. Later came accross the idea of Singleton/Static. I wanted to have a common class which will handle all connection related issues and at the same time give good performance.
    With due respect to all Java Gurus: i got all from web articles/tutorials/java forum etc. There is a long discussion regarding Singlet vs static in this forum. But finally got confused and could not figure out in my case which method shall i make use of, so tried both.
    What I want is somebody pointing out flwas inside my 2 code snippets and guide me about which method shall i adopt in future.
    Static way:
    package common;
    import java.sql.Connection;
    import javax.sql.DataSource;
    import java.sql.SQLException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public final class ConnectionManager_Static {
         private static InitialContext ctx = null;
         private static DataSource ds = null;
         public ConnectionManager_Static(){     }
         //as the staic method is updating static var i am synchonizing it
         private static synchronized void getDatasource () throws NamingException, SQLException
              if (ds == null){
                   ctx = new InitialContext();
                   ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MySql");
         //making getConnection() also static as it is not instance specific     
         public static Connection getConnection () throws NamingException, SQLException, Exception
              Connection conn = null;
              try{     
                   if (ds == null) {getDatasource ();}
                   if (ds != null) {
                        conn = ds.getConnection();                 
              }catch (Exception e){
                   throw new Exception("From ConnectionManager_Static",e);
              return conn;
           }//getConnection
    }Singleton:
    package common;
    import java.sql.*;
    import javax.sql.*;
    import javax.naming.*;
    public final class ConnectionManager_Singleton {
             private static ConnectionManager_Singleton INSTANCE = null;
              private DataSource datasource = null;
              // Private constructor for singleton pattern
             private ConnectionManager_Singleton() throws NamingException{
                   Context ctx = new InitialContext();
                   datasource = (DataSource)ctx.lookup("java:comp/env/jdbc/MySql");
             //synchronized creator for  multi-threading issues
             //another if check to avoid multiple instantiation
             private synchronized static void createInstance() throws NamingException{
                 if (INSTANCE == null) {
                     INSTANCE = new ConnectionManager_Singleton();
             public static ConnectionManager_Singleton getInstance() throws NamingException {
                 if (INSTANCE == null) createInstance();
                 return INSTANCE;
              public Connection getConnection() throws Exception
                   Connection con = null;
                   try{
                        con = datasource.getConnection();
                   }catch(Exception e){
                        throw new Exception("From connection manager singleton ", e);
                   return con;
    }Sorry, It's becoming long.
    Thanaks in advance,
    Manisha

  • Unable to create connection pool on admin console!

    Hello, i try via application server's admin console connect to my mysql database.
    The jdbc.mysql.Driver is already in as_home/lib directory.
    My database has no password and the root is authorized and has full access.
    My Configuration on admin console look like:
    Datasource Classname: Datasource Classname:
    Resource Type: javay.sql.DataSource
    use:root
    url:jdbc:mysql://localhost:3306/mydatabase
    When i ping the database i becom thes error:
    Operation 'pingConnectionPool' failed in 'resources' Config Mbean. Target exception message: No PasswordCredential found
    Please help
    Thanks

    hmm this looks like the password was not supplied. are you sure there is not password to access the db?
    this is an e.g of my connection pool connection.. its for ibm db2 though. so you might change it where appropriate.
    Datasource classname : COM.ibm.db2.jdbc.DB2DataSource
    Resource type: javax.sql.DataSource
    PortNumber: 50000
    DatabaseName: (the db name)
    Password: (password)
    User: (username)Clarence Loh

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

  • Database connection not closed in Destroy()  method of servlet

    Hi,
    I have a problem with my deployed web application. At first, I thought Glassfish was messing up on me, and after checking the log I could see plenty of null pointer exceptions being thrown at lines in my code where I generate prepared statements from my connection object. I have been initialising my connection in the Init() method of all my classes, and equally, I've been closing it in Destroy(). I can only imagine that destroy() isn't being called - since the log clearly shows "connection success" messages but not "connection closed" messages. I am connecting to the servlets via a J2ME app on my mobile phone. Does connecting in this way somehow not invoke the destroy method when the servlets work is complete? Am I going to need to move all my connection initilisation and closing into the necessary doGet/doPost methods of each of my servlets?
    Chris

    You shouldn't be keeping the connection that long open. It's a bad design. It will timeout sooner or later and your complete application will crash. Always acquire and close the connection in the shortest possible scope, preferably just in the same method block where you process the query and/or results. If you want to improve performance while connecting, consider using a connection pool.
    Back to the actual problem: a servlet is created only once during application's lifetime and not during every request as you appears to think.
    You may find this tutorial useful to read on about using the DAO pattern in JSP/Servlet.
    [http://balusc.blogspot.com/2008/07/dao-tutorial-use-in-jspservlet.html]

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

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

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

  • Database Connections Not Closing

    I'm using iBatis for PostgreSQL database access and frequently have problems with connections not being closed. Here is a copy of my sqlMapConfig file:
    ============================
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE sqlMapConfig
    PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
    "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
    <sqlMapConfig>
    <properties resource="ibatis.properties" />
    <settings
    lazyLoadingEnabled="true"
    cacheModelsEnabled="true"
    enhancementEnabled="false"
    useStatementNamespaces="false"
    />
    <transactionManager type="JDBC" commitRequired="true">
    <dataSource type="DBCP">
    <property name="driverClassName" value="${driver}" />
    <property name="url" value="${url}" />
    <property name="username" value="${username}" />
    <property name="password" value="${password}" />
    <property name="maxActive" value="10"/>
    <property name="maxIdle" value="5"/>
    <property name="maxWait" value="5000"/>
    <property name="logAbandoned" value="true"/>
    <property name="removeAbandoned" value="true"/>
    <property name="removeAbandonedTimeout" value="1"/>
    <property name="Driver.logUnclosedConnections" value="true"/>
    </dataSource>
    </transactionManager>
    <sqlMap resource="job-sqlMap.xml" />
    </sqlMapConfig>
    ============================
    Due to the logAbandoned and removeAbandoned settings, I get a report in my log file whenever there is a connection that was not properly closed. Here is one of those log entries:
    23:22:51.483 (10) Finalizing a Connection that was never closed:
    java.lang.Throwable: Connection was created at this point:
    at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:175)
    at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
    at org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
    at org.postgresql.Driver.makeConnection(Driver.java:393)
    at org.postgresql.Driver.connect(Driver.java:267)
    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
    at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:84)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:96)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
    at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.init(JdbcTransaction.java:48)
    at com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransaction.getConnection(JdbcTransaction.java:89)
    at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
    at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)
    at edu.calpoly.lib.multimedia.big.db.AutomaticPeriodUpdateIBatisImplDBHandler.getGamesWithAutomaticUpdatePolicy(AutomaticPeriodUpdateIBatisImplDBHandler.java:154)
    at edu.calpoly.lib.multimedia.big.game.AutoUpdateThread.run(AutoUpdateThread.java:155)
    The file: AutomaticPeriodUpdateIBatisImplDBHandler.java contains an iBatis call on line # 154:
    --> list = sqlMap.queryForList("getGamesWithAutoPolicy", null);
    from the map file:
    <select id="getGamesWithAutoPolicy" resultClass="java.util.HashMap">
    <![CDATA[
    SELECT gameid, policy
    FROM update_policy
    ]]>
    </select>
    Here is the code for the entire method that uses this transaction:
    ============================
    public List getGamesWithAutomaticUpdatePolicy() throws BIGDatabaseFacadeException
    List list = new ArrayList();
    try
    sqlMap.startTransaction();
    list = sqlMap.queryForList("getGamesWithAutoPolicy", null);
    sqlMap.commitTransaction();
    catch(SQLException sqle)
    throw new BIGDatabaseFacadeException(sqle);
    finally
    try
    sqlMap.endTransaction();
    catch(SQLException sqle)
    throw new BIGDatabaseFacadeException(sqle);
    return list;
    ============================
    I know that this should be handled as an automatic transaction, but I tried adding the start, commit and end transaction commands in my desperate attempt to fix this problem (but it still didn't help).
    Here is my code for creation of sqlMap -
    --> sqlMap = SqlMapClientBuilder.buildSqlMapClient(Resources.getResourceAsReader("sqlMaps.xml"));
    Except for the fact that occasionally connections are not closed, overall my database access using iBatis works very well.
    In the course of trying to fix this problem I've worked to update all my lib files to the latest versions, and here is current status:
    My iBatis lib file: ibatis-2.3.4.726.jar
    My JDBC driver: postgresql-8.4-701.jdbc3.jar
    Required commons files:
    commons-dbcp-1.2.2.jar
    commons-pool-1.5.3.jar
    Note that I tried adding --> commitRequired="true" to the transactionManager in sqlMaps.xml, hoping it might help, but no joy.
    Please help me figure out why my database connections often do not close. Thank you very much!

    I'm sorry, but I don't understand what you mean by "close the session." I believe iBatis is supposed to take care of all that automatically. My understanding is that all the user does is create the sqlMapClient and then use it along with various map files to query and update the database. iBatis does the rest.

  • Connection not closed in the database server end

    Hi,
    Our database server (sql server 2000) and java application are running in two different boxes. Because the java application sent to the db server quite a few queries that can not be completed (applications hangs there) due to huge amount of data (18 million records in one table and 1 million records in another table and there are joins among the three tables), we stopped the java program. However, in the db server end, the connections associated with these problem queries were not closed although the java app end already closed these connections by calling connection.close(). When this happened, we have to manually close the connection from sql server enterprise manager.
    Here are the questions.
    1)what could be the reason why db server does not close the connection?
    2)Is there any solution in the java end that could close the connection in the db server end when this situation happens? I say this situation happens, I mean in most cases when java application closes connection, db server closes connections in its end too.
    Thanks
    Mark

    mark.lin wrote:
    Thanks for your answers and questions.
    Here are the answers to your questions
    1)The jdbc driver is jturboJTurbo? Never heard of it. You mean this?
    http://www.newatlanta.com/products/jturbo/index.jsp
    Why pay for something when you have two options available that are free? One of them is from Microsoft itself. Whose idea was this?
    2)It's a desk top application.
    It seems to me that it should not be driver issue. I was this happened the Microsoft's own jdbc driver. By jdbc specification, although you don't close the connection explicitly in the program, the connection will be automatically closed in the java app end during garbage collection. Very bad - never depend on this. Always close your ResultSet, Statement, and Connection in reverse order of opening in a finally block, each one wrapped in individual try/catch blocks.
    One should never, ever depend on the GC to take care of resources like database connections or resource handles. Those should be cleaned up by your code.
    I tested this by intentionally not closing a connection. When I stops the application, the connection in the sql server end was also closed.
    But if you don't close the application and fail to close connections, you can see where eventually you'll exhaust the pool.
    It seems to me this is a sql server issue rather than a jdbc driver issue. I need way to prove this.
    Like I suggested, it's easy to swap in the jTDS driver and try it again. What do you have to lose?
    Or call Microsoft support and ask them. Or maybe JTurbo. You're paying for it - might as well use the support.
    %

  • Connection pooling does not work Oracle Objects! Oracle please respond!

    The problem is that when we retrieve Oracle Objects using pooled connection (closing logical connection at the end of every call)it takes 6-8 times longer than in case we share the same physical connection for all database calls. Parts of our application which do not utilize Oracle Objects (just old good relational data) works just fine with pooled connections - no performance degradation
    This is my reconstruction of f the what is happening behind the seen, so some parts can be not entirely correct.
    OracleConnection class caches StructDescriptor objects in descriptorCache hash table. StructDescriptor objects map content of oracle STRUCTs which are retrieved through the connection onto oracle type names. For example if you retrieve an instance of HR.EMPLOYEE_T oracle object from database some metadata will be retrieved and stored as an entry in descriptorCache cache table associated with "HR.EMPLOYEE_T" key to assist CustomDatum interface. It is a time consuming process and caching of this metadata improves it dramatically.
    Now when using pooled connection descriptorCache gets cleared when you close your logical connection (java.sql.Connection) so next time you get a connection from your pooled connection it will have to repopulate the cache which as I said is very time consuming. As a result even though we can reuse our physical connection by using pooled connection whole setup does not work - fetching metadata takes a long time and we cant use Oracle objects in EJB environment (or Servlet environment)
    Alex Roytman
    Peace Technology, Inc.
    (301) 206-9696
    null

    check out managed datasources in the manuals

  • Rookie Problem:Connection Pool Class not found

    Hi All,
    I'm new to java (3 days now!) and I was writing some sample JSP code to learn about Connection Pooling using Sun Server 8... My goal here is to hopefully learn how to use Connection pooling so I can develop a DAO class that uses good design patterens. It appears that that my J2EE server is not finding my db providers connection pooling class. If this is my problem where should I add this reference? I was looking at the Admin Console and did not see a way to add it there?
    Someone please send me down the right path :)
    I think my error is...."Wrong class name or classpath for Datasource Object : {0}
    java.lang.ClassNotFoundException: com.ibm.db2.jdbc.DB2ConnectionPoolDataSource" (see below for trace)
    Thanks in advance for the help and tips
    John
    My test JSP source code......
    <%/* JMM This page was created on 9/1/2004
    The purpose of this page is to test and learn basic JSP Connection Snytax and flow
    control */%>
    <%/* **********Begin JSP Page Directives********** */%>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@page import="javax.sql.*"%>
    <%@page import="java.sql.*"%>
    <%@page import="javax.naming.*"%>
    <%@page import="java.util.Hashtable"%>
    <%/* ********** End JSP Page Directive ********** */%>
    <%! String pageName = "Johns Test JSP Page";
    String jndi_ereporting_nm = "jdbc/F0654TE1";
    %>
    <html>
    <head><title><%=pageName%></title></head>
    <body>
    <%-- <jsp:useBean id="beanInstanceName" scope="session" class="beanPackage.BeanClassName" /> --%>
    <%-- <jsp:getProperty name="beanInstanceName" property="propertyName" /> --%>
    Importing the follwoing Libs<br>
    <br>import javax.sql.*;
    <br>import java.sql.*;
    <br>import javax.naming.*;
    <br>import java.util.Hashtable;
    <br>
    <br>Attempting to connnect to F0654TE1 using JNDI Lookup....
    <br>
    <%
              DataSource ds = null;
              Connection con = null;
              Context ctx = null;
              Hashtable env = null;
              long nStartTime, nStopTime, nElapsedTime;
              // Set up environment for creating InitialContext object
              //humm.. whats stored in here ....what are these used for?
    out.println("Context.INITIAL_CONTEXT_FACTORY=" + Context.INITIAL_CONTEXT_FACTORY + "<br>");
              out.println("Context.PROVIDER_URL=" + Context.PROVIDER_URL + "<br>");
              InitialContext ic = new InitialContext();
              ds = (DataSource) ic.lookup(jndi_ereporting_nm);
         out.println("open connection....<br>");
              con = ds.getConnection();
         out.println("connection has been opened!!!....<br>");
              con.close();
         out.println("connection has been closed!!!....<br>");     
    %>
    <br>
    <br>Finished attempting to connnect to F0654TE1 using JNDI....
    </body>
    </html>
    Errror Log file.....
    [#|2004-09-02T10:08:42.951-0400|SEVERE|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=11;|RAR5099 : Wrong class name or classpath for Datasource Object : {0}
    java.lang.ClassNotFoundException: com.ibm.db2.jdbc.DB2ConnectionPoolDataSource
         at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:141)
         at com.sun.gjc.common.DataSourceObjectBuilder.getDataSourceObject(DataSourceObjectBuilder.java:198)
         at com.sun.gjc.common.DataSourceObjectBuilder.constructDataSourceObject(DataSourceObjectBuilder.java:65)
         at com.sun.gjc.spi.DSManagedConnectionFactory.createManagedConnection(DSManagedConnectionFactory.java:70)
         at com.sun.enterprise.resource.LocalTxConnectorAllocator.createResource(LocalTxConnectorAllocator.java:63)
         at com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:501)
         at com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:176)
         at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:314)
         at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:260)
         at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:244)
         at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:137)
         at com.sun.enterprise.connectors.ConnectionManagerImpl.internalGetConnection(ConnectionManagerImpl.java:194)
         at com.sun.enterprise.connectors.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:94)
         at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:68)
         at org.apache.jsp.jsp.jndi_005fdb_005ftest_jsp._jspService(jndi_005fdb_005ftest_jsp.java:102)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:168)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:133)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:539)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:114)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:936)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:165)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:683)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:604)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:542)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
         at java.lang.Thread.run(Thread.java:534)
    |#]
    [#|2004-09-02T10:08:42.961-0400|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=11;|RAR5038:Unexpected exception while creating resource|#]
    [#|2004-09-02T10:08:42.961-0400|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=11;|RAR5117 : Failed to obtain/create connection. Reason : Class name is wrong or classpath is not set for : com.ibm.db2.jdbc.DB2ConnectionPoolDataSource|#]
    [#|2004-09-02T10:08:42.961-0400|WARNING|sun-appserver-pe8.0.0_01|javax.enterprise.resource.resourceadapter|_ThreadID=11;|RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.ibm.db2.jdbc.DB2ConnectionPoolDataSource]|#]
    [#|2004-09-02T10:08:43.131-0400|SEVERE|sun-appserver-pe8.0.0_01|javax.enterprise.system.container.web|_ThreadID=11;|StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.ibm.db2.jdbc.DB2ConnectionPoolDataSource
         at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:72)
         at org.apache.jsp.jsp.jndi_005fdb_005ftest_jsp._jspService(jndi_005fdb_005ftest_jsp.java:102)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:102)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:282)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:263)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:210)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:246)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:236)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:55)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:145)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:141)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:214)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:168)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:133)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:539)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:114)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:109)
         at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
         at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:107)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:522)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:936)
         at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:165)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:683)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:604)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:542)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:647)
         at java.lang.Thread.run(Thread.java:534)
    |#]

    Sorry this is not the way i usually handle db connectivity, i think you need to set up a name in your server.xml file (this is for tomcat based applicatin servers) which is then referenced in your jsp file. I have had a quick google and found this.
    http://manual.evolutionhosting.com/evochunk/ch19s04.html
    You menttioned that you wanted to devolp really good design patterns, how big is your project going to be, if it is going to be a large project then you may want to look at
    http://www.hibernate.org

  • Could not retrieve connection info from torque connection pool

    Hi,
    I am using Apache Torque for making connection with my Oracle 9i server.
    My Torque.properties file configuration is as follows:-
    torque.dsfactory.cpm.factory=org.apache.torque.dsfactory.SharedPoolDataSourceFactory
    torque.dsfactory.cpm.pool.maxActive=10
    torque.dsfactory.cpm.pool.maxWait=60
    torque.dsfactory.cpm.pool.testOnBorrow=true
    torque.dsfactory.cpm.pool.validationQuery=SELECT 1 from dual
    torque.dsfactory.cpm.connection.driver = oracle.jdbc.driver.OracleDriver
    I am getting the following error:-
    Caused by: org.apache.commons.dbcp.SQLNestedException: Could not retrieve connection info from pool
    at org.apache.commons.dbcp.datasources.SharedPoolDataSource.getPooledConnectionAndInfo(SharedPoolDataSource.java:169)
    According to me the cause of error is because of the database connection was not available in the connection pool. Or it might be due to The connection was not closed properly becuase of the some issue in the persistent layer.
    My Research till now:-
    Checked all the connection object properly closed in my classes as well as Torque Classes.
    Do anyone have any idea regarding this error. If yes, please suggest some solution for it.
    ----Anurag----

    Hi,
    I have my complete Torque.properties file, just for the reference, I have pasted few lines from my torque.properties file. Secondly, I am using the JDBC Driver for my oracle connection & its working fine. The problem is when my application tries to access connection from connection pool, & if it finds no connection in the pool it gives error. After increasing the size of the connection in the pool, still I am getting the same error. Do you have some idea regarding this.

Maybe you are looking for