Connection Pooling - application

I know, pool is set of connection in one application, and the whole pooling mechanism is served by client-side (ODP.NET). My question is: what does "application" means in ASP.NET+C# architecture. There is only ONE application which is aspnet_wp.exe, so there is only one pool,isn't it? So, we can say that MAX_POOL_SIZE param. in practice defines max. number of users who can connect to DB (in assumption, that each of them uses different connection string). I am right? Please, help.

I know, pool is set of connection in one application,
and the whole pooling mechanism is served by
client-side (ODP.NET). My question is: what does
"application" means in ASP.NET+C# architecture. In .NET parlance "application" typically means "AppDomain". An appdomain is a partitioned memory space inside a process. In the case of ASP.NET each web application has its own AppDomain inside the aspnet_wp process.
There
is only ONE application which is aspnet_wp.exe, so
there is only one pool,isn't it? In general, objects in other AppDomains are not accessable. You would have to use remoting to share connections across AppDomains. So each AppDomain has its own pool of connections.
David

Similar Messages

  • How to use JDBC Connection Pools in a standalone application?

    Hi, there,
    I have a question about how to use JDBC Connection Pools in an application. I know well about connection pool itself, but I am not quite sure how to keep the pool management object alive all the time to avoid being destroyed by garbage collection.
    for example, at the website: http://www.developer.com/java/other/article.php/626291, there is a simple connection pool implementation. there are three classes:JDBCConnection, the application's gateway to the database; JDBCConnectionImpl, the real class/object to provide connection; and JDBCPool, the management class to manage connection pool composed by JDBCConnectionImpl. JDBCPool is designed by Singleton pattern to make sure only one instance. supposing there is only one client to use connection for many times, I guess it's ok because this client first needs instantiate JDBCPool and JDBCConnectionImpl and then will hold the reference to JDBCPool all the time. but how about many clients want to use this JDBCPool? supposing client1 finishes using JDBCPool and quits, then JDBCPool will be destroyed by garbage collection since there is no reference to it, also all the connections of JDBCConnectionImpl in this pool will be destroyed too. that means the next client needs recreate pool and connections! so my question is that if there is a way to keep pool management instance alive all the time to provide connection to any client at any time. I guess maybe I can set the pool management class as daemon thread to solve this problem, but I am not quite sure. besides, there is some other problems about daemon thread, for example, how to make sure there is only one daemon instance? how to quit it gracefully? because once the whole application quits, the daemon thread also quits by force. in that case, all the connections in the pool won't get chance to close.
    I know there is another solution by JNDI if we develop servlet application. Tomcat provides an easy way to setup JNDI database pooling source that is available to JSP and Servlet. but how about a standalone application? I mean there is no JNDI service provider. it seems a good solution to combine Commons DBCP with JNID or Apache's Naming (http://jakarta.apache.org/commons/dbcp/index.html). but still, I don't know how to keep pool management instance alive all the time. once we create a JNDI enviroment or naming, if it will save in the memory automatically all the time? or we must implement it as a daemon thread?
    any hint will be great apprieciated!
    Sam

    To my knoledge the pool management instance stays alive as long as the pool is alive. What you have to figure out is how to keep a reference to it if you need to later access it.

  • How database connection pooling works in a application

    Hi Guys,
    I am new to Java and looking into best way of doing J2ee database conectivity. I am using Eclipse galileo3.5 J2EE with Mysql database and Tomcate 6.0.
    I am developing an email application where I need to implement MVC model for my webapplication, using jsp for presentation, servlet for control and java beans for model.
    I came across two tutorial for database connection pooling as given below.
    Eclipse Corner Article: Creating Database Web Applications with Eclipse - In this tutorial connection pooling is configure in Tomcate 6.0
    It says Copy and paste the following into your context.xml file (you may have to click on the Source tab at the bottom of the editor to be able to paste). This defines a DataSource with the name "jdbc/SampleDB". Our application will retrieve database connections from the pool using this name.
    <?xml version="1.0" encoding="UTF-8"?>
    <Context>
    <Resource name="jdbc/SampleDB" auth="Container"
    type="javax.sql.DataSource"
    username="app" password="app"
    driverClassName="org.apache.derby.jdbc.ClientDrive r"
    url="jdbc:derby://localhost:1527/sample"
    maxActive="8" />
    </Context>
    Where as in second tutorial - http://www.roseindia.net/answers/viewanswers/2838.html
    It uses java bean for connection pooling and then use straight way in JSP and no Servlet used.
    conpool.jsp
    <%@page import="java.sql.Connection"%>
    <jsp:useBean id="pl" class="com.CoreJava.ConnectionPooling"/>
    <% Connection con = pl.getConnection(); %>
    //do something using con
    connectionPooling.java
    import com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolD ataSource;
    public class ConnectionPooling
    static Connection con=null;
    public static Connection getConnection()
    try
    MysqlConnectionPoolDataSource po=new MysqlConnectionPoolDataSource();
    po.setServerName("localhost");
    po.setPortNumber(3306);
    po.setDatabaseName("mydatabase"); //changeur database name
    po.setUser("root");//ur username
    po.setPassword("");//ur password
    con = po.getConnection();
    catch(Exception e)
    System.out.println("Exception Connection :"+e);
    return con;
    Please some one explain which is the best way of doing connection pooling to the database by using MVC pattern
    Please if some one advise me how to use MVC architecture for simple email application and database connectivty.
    Thanks

    >
    >
    Where as in second tutorial - http://www.roseindia.net/answers/viewanswers/2838.html
    Never EVER use roseindia. It is terrible shit.
    [http://balusc.blogspot.com/2008/06/what-is-it-with-roseindia.html]
    The correct answer is what you found in the eclipse article. And you can read the Tomcat docs for more.
    As per usual the code you have posted from Roseindia is a big pile of rubbish that was written by a complete idiot. I mean the person who wrote it apparently doesn't know much Java at all. Let alone JDBC. Or Connection pools. Or J2EE. It's not the worst I've seen from them but it's pretty bad.

  • Creating a connection pool using Oracle 10g, Sun ONE Application Serve 8.1

    Has any one succesfully configured Oracle 10g to work with Sun ONE Application Server 8.1 on Windows 2000 server service pack 4? I am embarking on a new J2EE project and I need to configure it as soon as possible.

    I haven't done it myself on that particular service pack, but I don't see why it should be any different than configuring a connection pool on other vanilla win2k/other OSes.
    Would you please try and let this forum know?
    thanks.

  • Creating a connection pool using SQL Server 2000, Sun ONE Application Serve

    Has any one succesfully configured SQL Server 2000 to work with Sun ONE Application Server 7 on Windows 2000 server service pack 4? I am embarking on a new J2EE project and I need to configure it as soon as possible.
    The problem I am having is that, when I ping the data souce name, there is a connection error.
    I have set the data source name and other details as follows:
    Under JDBC, I have set the parameters for the connection pool as follows:
    Data Source Name:      com.microsoft.jdbc.sqlserver.SQLServerDriver
    Database Name:          jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Test
    User:               test
    Password:          test
    In the JVM settings page, I have set the prefix class path as follows for the location of the Microsoft JDBC
    drivers that I downloaded as follows:
    c:\microsoft\drivers/lib/msbase.jar
    c:\microsoft\drivers/lib/msutil.jar
    c:\microsoft\drivers/lib/mssqlserver.jar
    Under JVM Options, there is a strange setting which I don't understand: perhaps this is the cause of the
    connction error?
    -Djdbc.drivers=com.pointbase.jdbc.jdbcUniversalDriver
    Please help????

    I'm in a similar boat...
    Trying to setup AS7 JDBC and followed the instructions on the link you provided and get the following exception. I kept the case the same, thinking 'setpassword" was incorrect, so I tried changing the property to "Password", but get the same exception but it points to "setPassword" instead.
    SEVERE: RAR5041:Cannot get jdbc connection
    com.sun.enterprise.repository.J2EEResourceException
    java.lang.NoSuchMethodException: setpassword
    at com.sun.enterprise.repository.JdbcConnectionPool.createDataSource(JdbcConnectionPool.java:243)
    at com.sun.enterprise.resource.JdbcUrlAllocator.createResource(JdbcUrlAllocator.java:80)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:856)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:416)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:625)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520)
    at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263)
    at com.sun.enterprise.resource.JdbcXAConnection.<init>(JdbcXAConnection.java:74)
    at com.sun.enterprise.resource.Jdbc10XaAllocator.createResource(Jdbc10XaAllocator.java:94)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.createSteadyResources(IASNonSharedResourcePool.java:856)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.initPool(IASNonSharedResourcePool.java:416)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.internalGetResource(IASNonSharedResourcePool.java:625)
    at com.sun.enterprise.resource.IASNonSharedResourcePool.getResource(IASNonSharedResourcePool.java:520)
    at com.sun.enterprise.resource.PoolManagerImpl.getResourceFromPool(PoolManagerImpl.java:263)
    at com.sun.enterprise.resource.PoolManagerImpl.getResource(PoolManagerImpl.java:170)
    at com.sun.enterprise.resource.JdbcDataSource.internalGetConnection(JdbcDataSource.java:241)
    at com.sun.enterprise.resource.JdbcDataSource.getConnection(JdbcDataSource.java:98)
    at com.rvi.database.jdbcConnection.getConnection(jdbcConnection.java:93)
    at com.webapp.database.ArticlesDAO.selectByYear(ArticlesDAO.java:102)
    at com.webapp.actions.ArticleAction.list(ArticleAction.java:96)
    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.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)

  • Connection pool for big web application

    hi,
    i am developing an application which had more then 20 classes and each class use databases.
    i made an connection bean and use it for database connectivity but as my code expand and my application run for longer time i start getting error of connection limit.
    then i start using connection pool. in this i start using one connection for whole application.
    now i want that my
    1-whole application use that connection pool and i dont need to initialize it in different classes.
    2- The main problem is that may at a time i have to connect database with different user and these connections should remain active.
    my application will be used for enterprise level and remain active for months .
    following is my connection pool
    public class ConnectionPool implements Runnable
          private Log log=new Log();
          private String driver, url, username, password;
          private int maxConnections;
          private boolean waitIfBusy;
          private Vector availableConnections, busyConnections;
          private boolean connectionPending = false;
          public ConnectionPool(String driver, String url,String username, String password,int initialConnections, int maxConnections, boolean waitIfBusy) 
              this.driver         =     driver;
              this.url            =     url;
              this.username       =     username;
              this.password       =     password;
              this.maxConnections =     maxConnections;
              this.waitIfBusy     =     waitIfBusy;
              if (initialConnections > maxConnections)
                initialConnections = maxConnections;
              availableConnections = new Vector(initialConnections);
              busyConnections = new Vector();
              try
                  for(int i=0; i<initialConnections; i++)
                    availableConnections.addElement(makeNewConnection());
              catch(Exception e)
                log.write(e.getMessage());
          }//EO constructor
      public synchronized Connection getConnection()
             if (!availableConnections.isEmpty())
                  log.write("Total connections="+availableConnections.size());
                  Connection existingConnection =  (Connection)availableConnections.lastElement();
                  int lastIndex = availableConnections.size() - 1;
                  availableConnections.removeElementAt(lastIndex);
                  // If connection on available list is closed (e.g.,it timed out), then remove it from available list
                  // and repeat the process of obtaining a connection. Also wake up threads that were waiting for a connection because maxConnection limit was reached.
                        try
                            if (existingConnection.isClosed())
                              notifyAll(); // Freed up a spot for anybody waiting
                              return(getConnection());
                            else
                              log.write(  "in available connection"  );
                              busyConnections.addElement(existingConnection);
                              return(existingConnection);
                        catch(SQLException se)
                            log.write(se.getMessage());
              } else {
                        // Three possible cases:
                        // 1) You haven't reached maxConnections limit. So establish one in the background if there isn't
                        //    already one pending, then wait for the next available connection (whether or not it was the newly established one).
                        // 2) You reached maxConnections limit and waitIfBusy flag is false. Throw SQLException in such a case.
                        // 3) You reached maxConnections limit and waitIfBusy flag is true. Then do the same thing as in second
                        //    part of step 1: wait for next available connection.
                        if ((totalConnections() < maxConnections) &&  !connectionPending)
                          makeBackgroundConnection();
                        else if (!waitIfBusy)
                            log.write("Connection limit reached");
                        // Wait for either a new connection to be established (if you called makeBackgroundConnection) or for
                        // an existing connection to be freed up.
                        try {
                          wait();
                        catch(InterruptedException ie)
                          log.write(ie.getMessage());
                  // Someone freed up a connection, so try again.
                return(getConnection());
              }//EO main if-else
          return null;
    }//EO getconnection method
      // You can't just make a new connection in the foreground
      // when none are available, since this can take several
      // seconds with a slow network connection. Instead,
      // start a thread that establishes a new connection,
      // then wait. You get woken up either when the new connection
      // is established or if someone finishes with an existing
      // connection.
      private void makeBackgroundConnection() {
        connectionPending = true;
        try {
          Thread connectThread = new Thread(this);
          connectThread.start();
        } catch(OutOfMemoryError oome) {
          // Give up on new connection
          log.write(oome.getMessage());
      public void run() {
        try {
          Connection connection = makeNewConnection();
          synchronized(this) {
            availableConnections.addElement(connection);
            connectionPending = false;
            notifyAll();
        } catch(Exception e) { // SQLException or OutOfMemory
          // Give up on new connection and wait for existing one free up.
          log.write(e.getMessage());
      // This explicitly makes a new connection. Called in
      // the foreground when initializing the ConnectionPool,
      // and called in the background when running.
      private Connection makeNewConnection()
        //log.write("make new connection with  "+url+" "+username+" "+password +" and driver= "+driver);
        Connection connection=null;
          try
            // Load database driver if not already loaded
            //Class.forName(driver);
             DriverManager.registerDriver(new OracleDriver());
            // Establish network connection to database
            connection =  DriverManager.getConnection(url, username, password);
                    if( connection.isClosed() )
                      log.write("ooooooops no connection");
                    else
                      log.write("yahoooo get connection");
          catch(Exception e)
            log.write(e.getMessage());
        return(connection);
      public synchronized void free(Connection connection) {
        busyConnections.removeElement(connection);
        availableConnections.addElement(connection);
        // Wake up threads that are waiting for a connection
        notifyAll();
      public synchronized int totalConnections() {
        return(availableConnections.size() + busyConnections.size());
      /** Close all the connections. Use with caution:
       *  be sure no connections are in use before
       *  calling. Note that you are not <I>required</I> to
       *  call this when done with a ConnectionPool, since
       *  connections are guaranteed to be closed when
       *  garbage collected. But this method gives more control
       *  regarding when the connections are closed.
      public synchronized void closeAllConnections() {
        closeConnections(availableConnections);
        availableConnections = new Vector();
        closeConnections(busyConnections);
        busyConnections = new Vector();
      private void closeConnections(Vector connections) {
        try {
          for(int i=0; i<connections.size(); i++) {
            Connection connection =
              (Connection)connections.elementAt(i);
            if (!connection.isClosed()) {
              connection.close();
        } catch(SQLException sqle) {
          // Ignore errors; garbage collect anyhow
          log.write(sqle.getMessage());
      }i get this code from internet, in which it also mention that use following code
    public class BookPool extends ConnectionPool {
    private static BookPool pool = null;
    private BookPool(...) {
    super(...); // Call parent constructor
    public static synchronized BookPool getInstance() {
    if (pool == null) {
    pool = new BookPool(...);
    return(pool);
    }if some one want to use it for whole application then use connection pool by BookPool,
    now main point is i m not getting the BookPool class could some one explain it to me???
    and second by using it can i connect to different users of DB at a time, if cant then how i can.
    its good if some one explain it by little code.
    thxxxxxxxxxxxxxxxxxx

    If this is a real, serious application and not just for practice, then why are you trying to write your own connection pool implementation?
    You'd better use Jakarta's Commons Pool and Commons DBCP, which are widely used, well tested implementations of connection pools.
    If this is a web application running in a J2EE container, you'd normally configure the connection pool in the container. The container will register the pool in JNDI and you'd look it up in JNDI from your application.
    Here's some documentation on how to do that in Tomcat 5.5: JNDI Datasource HOW-TO

  • JDev 10.1.3 - running any application results in connection pool error

    After creating a new project with a MySQL connection and since removing the project, I receive this error no matter which application I try to run through the local OC4J of JDev 10.1.3.0.4.3673.
    I can recreate this issue with a brand new app workspace & project with a single html file.
    06/07/06 14:08:19 WARNING: Application.setConfig Application: current-workspace-app is in failed state as initialization failedjava.lang.InstantiationException: Error occurred initializing connectors. Exception is: Exception creating connection pool. Exception: oracle.oc4j.sql.config.DataSourceConfigException: Unable to create : com.mysql.jdbc.Driver
    Jul 6, 2006 2:08:19 PM com.evermind.server.Application setConfig
    I'm guessing this is a connection pool issue, but I'm not sure how I associated this connection to the pool, or where to remove it. I've reviewed the help files and searched through this forum, and see references to the connection pool on the AS, but not JDev 10.1.3 itself.
    Any pointers are appreciated! In the mean time I'm continuing my search!

    Can you please clarify the following...
    1) Can we run MDB applications within JDeveloper 10.1.3 ? I noticed there is a jms.xml file in embedded OC4J.
    2) How can we test MDB applications within JDeveloper linked to a JMS Destination OC4J based ?

  • Sun Java Systems Application Server 9 connection-pool ping error

    Hi folks, I tried creating a javax.sql.DataSource MSSQL database connection pool with the jdts type 4 driver I got from sourceforge, and each ping operation I tried gave me the following error message:
    Operation 'pingConnectionPool' failed in 'resources' Config MBean.
    Target exception message: No PasswordCredential found.
    My connection properties are:
    user = sa
    port = 1433
    databaseName = FlyMyWayDB
    serverName = digitanx-chalu
    What does this exception mean, what are the possible causes, and how do I go about resolving it.
    I will really appreciate any help, thanks.

    As long as the JDBC Driver (jar file) for the connection pool(s) you want to create are in the app server's lib directory, you shouldn't have a problem creating both those and the JDBC Resources from the admin console (web app). So far, I am able to bundle my connection pools and resource connections inside my ejb module under "Server Resources" within my enterprise (.ear) application in Netbeans 5.5. When I deploy it, the whole thing works pretty sweet. I haven't gotten to the stage where I will want to migrate the jee application to my dedicated server yet, but I suspect that if my dedicated (remote) app server doesn't want to play nice with my netbeans when I try and set it up as a new server under my "Server Manager", then I'll likely try to simply deploy the .ear file from within the admin console, using the "browse" (for .ear) option (likely the better/preferred practice for production anyhow). Thanks for the dukes! My very first ones ever!

  • Connection Pooling in heavy traffic web-applications

    In a 24x7 web-app used by 3000-10000 concurrent users, what is the
    realistic number of maxmimum connections one should
    have defined in the application server's connection pool?
    The app has no caching mechanism therefore every page is a database
    hit. Does max connection of 20 make sense when at any time 1000 users
    could be using the web-app?
    Is that number dictated by the DBA or the Java app developer?
    For example, web sites like Amazon.com sure must be using connection
    pools to control access to resources. Do they define 20 max connections
    or 200 max connections to their database? Do they have multiple replicated databases, how are the databases synced up.

    If I were to rephrase this question like
    In Weblogic 7.0, if my connection pool has
    1. Minimum capacity = 10
    2. Maximum capacity = 100
    3. Capacity Increment = 1
    And say 100 users are connected to my site using all 100 connections available.
    What happens to the 101th user?
    1. Will he be waiting for the connection to be free which was held up by 100 users?
    2. Will he get a Error/Exception regarding the same?
    Rgds,
    Seetesh

  • Connection Pooling in Core Java Application

    I need to implement Connection pooling in core java applications..
    My database is MySQL 5.0.27 and java version 1.5.0_09
    Any links or ideas will be really appreciated

    but i just wanted to know, how can i do that in core java application. i have used connection pooling in Tomcat using dbcp
    but these are my questions.
    1. How can i run a core java application doing TCP connection in an Application Server which has got Tomcat and i'm asked to do connection pooling in the Tomcat server.xml.. I didn't understand this requirement pls help me... plssssssssssss

  • How to check if Connection Pooling is used in our application

    We have an ASP.NET application designed by developer team.
    All the files are .aspx
    They are all hosted in an Windows IIS and connect to Oracle database.
    I was reading some forums where people are suggesting to use "connection pooling" for better database performance.
    Now is there anyway I can check in code of the .aspx files to see if our team is using connection pooling method or not.

    Connection pooling is on by default. The easiest way to check is to check the connect string. If "pooling=false" is there, it's been turned off. If "pooling=true" is specified, or if it's not specified at all, it's on.
    Hope it helps,
    Greg

  • How to make connection Pool for standalone Application

    hi
    I have got an application to craete a stadalone appliaction for connection pool.But it is taking m more time to create the Connection and fetch the data.
    import java.sql.*;
    import java.util.*;
    /** A class for preallocating, recycling, and managing
    *  JDBC connections.
    *  <P>
    *  Taken from Core Servlets and JavaServer Pages
    *  from Prentice Hall and Sun Microsystems Press,
    *  http://www.coreservlets.com/.
    *  &copy; 2000 Marty Hall; may be freely used or adapted.
    public class ConnectionPool implements Runnable {
      private String driver, url, username, password;
      private int maxConnections;
      private boolean waitIfBusy;
      private Vector availableConnections, busyConnections;
      private boolean connectionPending = false;
      public ConnectionPool(String driver, String url,
                            String username, String password,
                            int initialConnections,
                            int maxConnections,
                            boolean waitIfBusy)
          throws SQLException {
        this.driver = driver;
        this.url = url;
        this.username = username;
        this.password = password;
        this.maxConnections = maxConnections;
        this.waitIfBusy = waitIfBusy;
        if (initialConnections > maxConnections) {
          initialConnections = maxConnections;
        availableConnections = new Vector(initialConnections);
        busyConnections = new Vector();
        for(int i=0; i<initialConnections; i++) {
          availableConnections.addElement(makeNewConnection());
      public synchronized Connection getConnection()
          throws SQLException {
        if (!availableConnections.isEmpty()) {
          Connection existingConnection =
            (Connection)availableConnections.lastElement();
          int lastIndex = availableConnections.size() - 1;
          availableConnections.removeElementAt(lastIndex);
          // If connection on available list is closed (e.g.,
          // it timed out), then remove it from available list
          // and repeat the process of obtaining a connection.
          // Also wake up threads that were waiting for a
          // connection because maxConnection limit was reached.
          if (existingConnection.isClosed()) {
            notifyAll(); // Freed up a spot for anybody waiting
            return(getConnection());
          } else {
            busyConnections.addElement(existingConnection);
            return(existingConnection);
        } else {
          // Three possible cases:
          // 1) You haven't reached maxConnections limit. So
          //    establish one in the background if there isn't
          //    already one pending, then wait for
          //    the next available connection (whether or not
          //    it was the newly established one).
          // 2) You reached maxConnections limit and waitIfBusy
          //    flag is false. Throw SQLException in such a case.
          // 3) You reached maxConnections limit and waitIfBusy
          //    flag is true. Then do the same thing as in second
          //    part of step 1: wait for next available connection.
          if ((totalConnections() < maxConnections) &&
              !connectionPending) {
            makeBackgroundConnection();
          } else if (!waitIfBusy) {
            throw new SQLException("Connection limit reached");
          // Wait for either a new connection to be established
          // (if you called makeBackgroundConnection) or for
          // an existing connection to be freed up.
          try {
            wait();
          } catch(InterruptedException ie) {}
          // Someone freed up a connection, so try again.
          return(getConnection());
      // You can't just make a new connection in the foreground
      // when none are available, since this can take several
      // seconds with a slow network connection. Instead,
      // start a thread that establishes a new connection,
      // then wait. You get woken up either when the new connection
      // is established or if someone finishes with an existing
      // connection.
      public void makeBackgroundConnection() {
        connectionPending = true;
        try {
          Thread connectThread = new Thread(this);
          connectThread.start();
        } catch(OutOfMemoryError oome) {
          // Give up on new connection
      public void run() {
        try {
          Connection connection = makeNewConnection();
          synchronized(this) {
            availableConnections.addElement(connection);
            connectionPending = false;
            notifyAll();
        } catch(Exception e) { // SQLException or OutOfMemory
          // Give up on new connection and wait for existing one
          // to free up.
      // This explicitly makes a new connection. Called in
      // the foreground when initializing the ConnectionPool,
      // and called in the background when running.
      public Connection makeNewConnection()
          throws SQLException {
        try {
          // Load database driver if not already loaded
          Class.forName(driver);
          // Establish network connection to database
          Connection connection =
            DriverManager.getConnection(url, username, password);
          return(connection);
        } catch(ClassNotFoundException cnfe) {
          // Simplify try/catch blocks of people using this by
          // throwing only one exception type.
          throw new SQLException("Can't find class for driver: " +driver);
      public synchronized void free(Connection connection) {
        busyConnections.removeElement(connection);
        availableConnections.addElement(connection);
        // Wake up threads that are waiting for a connection
        notifyAll();
      public synchronized int totalConnections() {
        return(availableConnections.size() +
               busyConnections.size());
      /** Close all the connections. Use with caution:
       *  be sure no connections are in use before
       *  calling. Note that you are not <I>required</I> to
       *  call this when done with a ConnectionPool, since
       *  connections are guaranteed to be closed when
       *  garbage collected. But this method gives more control
       *  regarding when the connections are closed.
      public synchronized void closeAllConnections() {
        closeConnections(availableConnections);
        availableConnections = new Vector();
        closeConnections(busyConnections);
        busyConnections = new Vector();
      public void closeConnections(Vector connections) {
        try {
          for(int i=0; i<connections.size(); i++) {
            Connection connection =
              (Connection)connections.elementAt(i);
            if (!connection.isClosed()) {
              connection.close();
        } catch(SQLException sqle) {
          // Ignore errors; garbage collect anyhow
      public synchronized String toString() {
        String info =
          "ConnectionPool(" + url + "," + username + ")" +
          ", available=" + availableConnections.size() +
          ", busy=" + busyConnections.size() +
          ", max=" + maxConnections;
        return(info);
    }///// The Calling Class is below---------/////////////////
    import java.util.*;
    import java.sql.*;
    public class dbConnection
         public static void main(String[] args)
              String driver="oracle.jdbc.driver.OracleDriver";
              String username="ETS";
              String password="ETS";
              String url="jdbc:oracle:thin:@192.168.47.10:1521:ETS";
              int initialConnections=10;
            int maxConnections=50;
              boolean waitIfBusy=false;
              Connection con=null;
              Statement stmt = null;
              ResultSet rs = null;
              try
              System.out.println("Before constructory "+new java.util.Date());
              ConnectionPool pool=new ConnectionPool(driver,url,username,password,initialConnections,maxConnections,waitIfBusy);
              System.out.println("After constructory "+new java.util.Date());
                        con=pool.makeNewConnection();
         System.out.println("After Connection pool "+new java.util.Date());
                        String sql="select * from emp_master";
                        stmt = con.createStatement();
                        rs = stmt.executeQuery(sql);
                        while(rs.next()) {
                   int login1=rs.getInt("emp_code");     
                        System.out.println("Employee Code is  "+login1);
                        System.out.println("check 2");
                   String pass=rs.getString("PASSWORD");
                        System.out.println("Pass Word is "+pass);
              }catch(Exception e)
                   System.out.println("Exception is "+e);
              finally {
    }

    I once created a connection pool programatically with Apache DBCP API. It didnt took more than 10 lines. Unforchunetly I dont have to code with me now.
    But If I remember right there is a sample code for that in the Apache Commans DBCP documentation.

  • How to use connection pool of datasource to make applications run faster?

    Hi, erveryone
    I prepare to implement a servlet that access database and do sync with client.
    When I access database, I would like to configure a datasource in weblogic and use connection pool.
    In order to make servlet application run significantly faster, my servet how to use connection poo is much moreresonable?
    For example, my servlet has many times database access. Is it true that geting and close a connection whenever
    one time database access finished?
    If from the servlet begins, the db connection is hold till servlet finalize. Will the solution affect the servlet performance? Is there any official document to introduce connection pool program? I search some documents.
    <The Java EE 6Tutorial> introduce some simple intruduction about connection pool.

    1. Use WebLogic Servers Data Source for Database Connections.
    2. Open and close the connections where you need it. Dont open it in begin and close in finalise. That is bad practice.
    3. Even when you invoke Connection.close () webLogic will not close the connection. it will commit the transaction and return it back to the pool rather than physically closing the DB connection.
    4. You can tune data source for minimum, maximum and increments of connections that you need based on your application requirement.

  • KIMYONG : Applications Database Connection Pool 관련 parameter 설명

    Purpose
    JVM 이 과도한 CPU / Memory를 사용하게 되어 Application Performance에 영향을 미칠때가 있으며 이럴경우 Connection Pool 관련하여 Parameter Tunning을 해야 할때가 있습니다. 이때 사용되는 Parameter들의 의미를 설명하고자 합니다.
    The Applications Database Connection Pool is a pool of JDBC database connections that are shared among java applications. Applications obtain connections from the pool by using the getJDBCConnection(...) methods of AppsContext.
    Essentially, each AppsContext has a single database connection associated with it at all times.
    The AOL/J layer internally borrows and returns this connection to the pool as needed to maintain connection reference that is properly initialized for the current Java tier AOL security context and NLS state.
    FND_MAX_JDBC_CONNECTIONS
    ============================
    The maximum pool size is the maximum allowed sum of the number of available connections and thenumber of locked connections. If the pool reaches the maximum size and all connections are locked, new clients will not be able to borrow a connection until one of the current clients has returned one. The default setting for this parameter is essentially unlimited (about 2 billion).
    FND_JDBC_BUFFER_MIN
    ======================
    The buffer minimum is the minimum number of connections that the pool should try to maintain in the available list. When the buffer size falls below the buffer minimum, the pool maintenance thread will be notified to create new connections. When notified, the thread will immediately attempt to create the number of connections to fill the difference. New connections will not be created if the pool is already at its maximum size. When creating new connections the thread uses the attributes of the most recent client request that resulted in a new connection being created.
    Setting this parameter to "0" will disable maintenance of the buffer minimum.
    However, the buffer maximum will still be maintained.
    Setting this parameter to a number greater than the maximum pool size(FND_MAX_JDBC_CONNECTIONS) will disable all buffer maintenance.
    FND_JDBC_BUFFER_MAX
    ======================
    The buffer maximum is the maximum number of connections that the pool should try to maintain in the available list. During heavy usage, the buffer may exceed this maximum. However, during periods of low usage, the maintenance thread will decrease the buffer size until the buffer maximum is reached.
    If the value of this parameter is an integer, (for example "20") the buffer maximum is static. If the value is a percent (for example, "20%"), the buffer maximum is not constant but instead is calculated dynamically as a percent of total pool size. The buffer minimum is also taken into account when
    determining a dynamic buffer maximum.
    The exact expression used is:
    maximum(t) = buffer minimum + ( (FND_JDBC_BUFFER_MAX/100) * size(t) )
    where maximum(t) and size(t) are the buffer maximum and pool size at some time t.
    The thread is configured to periodically check the buffer size. If the buffer size is greater than the maximum, the thread will remove either the number of available connections specified by FND_JDBC_BUFFER_DECAY_SIZE or the number of connections in excess of the buffer minimum, whichever is smaller. When connections are removed from the available list, the least recently used ones are removed first.
    Setting this parameter to100%, or to a number equal to FND_MAXIMUM_JDBC_CONNECTIONS, or to a number less than or equal to FND_JDBC_BUFFER_MIN will effectively prevent the maintenance thread from ever removing any connections.
    FND_JDBC_BUFFER_DECAY_INTERVAL
    ===================================
    The buffer decay interval specifies how often the connection pool maintenance thread should check the buffer size. The thread will check the buffer size at most once every FND_JDBC_BUFFER_DECAY_INTERVAL seconds. The actual time between consecutive thread cycles will vary somewhat depending on the JVM load.
    This parameter, along with FND_JDBC_BUFFER_DECAY_SIZE, allows the buffer decay rate to be tuned. For example, if the buffer decay size is 2 and the buffer decay interval is one minute, the buffer decay rate will never exceed two connections per minute. When connections are removed, the least recently used ones are removed first.
    FND_JDBC_BUFFER_DECAY_SIZE
    =============================
    The buffer decay size specifies the maximum number of connections that should be removed during any single thread cycle during which the number of available connections is greater than the buffer size. This parameter, along with FND_JDBC_BUFFER_DECAY_INTERVAL, allows the buffer decay rate to be tuned.
    FND_JDBC_MAX_WAIT_TIME
    =========================
    The maximum wait time specifies how much time a client should spend trying to get a connection. The borrow algorithm, used to borrow an object from the pool, contains check points at which the elapsed time is compared to the maximum wait time. If it exceeds the maximum wait time, then a null object will be returned to the client. The pre-configured value for the maximum wait time is
    10 seconds.
    FND_JDBC_SELECTION_POLICY
    ============================
    The selection policy determines how a connection is selected from the list of available connections for a particular client. The connection pool is pre-configured to use a cost-based selection algorithm, which selects the connection that will require the smallest amount of initialization to match the
    client's context.
    FND_JDBC_USABLE_CHECK
    ===========================
    The FND_JDBC_USABLE_CHECK parameter governs whether a pl/sql query is performed before giving a connection to a client. The pool checks whether a connection is usable before handing it to a client. This always involves checking that the connection is not null and is not closed. If FND_JDBC_USABLE_CHECK is set to true, then it also verifies that the connection can be used to perform a simple PL/SQL query. (This parameter may have to be set to "true" in order to clean up
    connections to a database that has been restarted.)
    FND_JDBC_CONTEXT_CHECK
    ==========================
    The FND_JDBC_CONTEXT_CHECK parameter governs whether the AOL security context and NLS state is obtained from the database when the connection is returned to the pool. If FND_JDBC_CONTEXT_CHECK is "true", when the connection is returned to the pool, the AOL security context and NLS state will be obtained from the database. (This is implemented in the DBConnObj.isReusable() method). This check must be done when the connection is returned (rather than when it is borrowed) so that the selection matching algorithm has access to the actual
    session context of the connections in the available list.
    FND_JDBC_PLSQL_RESET
    ========================
    The PL/SQL reset flag, set using the variable FND_JDBC_PLSQL_RESET, governs whether the PL/SQL state associated with a connection should be freed before the pool hands the connection to the client. By default this flag is false.
    If the flag is set by true, by including the line "FND_JDBC_PLSQL_RESET=true" in the .dbc file, each connection to the database will have its PL/SQL state cleared before the pool returns the connection to the client.
    This is how it works. After the pool selects a connection from the available list for a client, it initializes the connection. One of the things initialization does is to set a flag that is later used by SessionManager to determine if the apps initialization routine needs to be performed for the connection. When FND_JDBC_PLSQL_RESET has been set to "true", this flag will always be set to true. After the pool initializes the connection, it also checks whether the connection is usable. In this case, this check will include a call to DBMS_SESSION.RESET_PACKAGE, which frees the PL/SQL state. The table below summaries the affect of FND_JDBC_PLSQL_RESET and the other safety check parameters on borrowing a connection from the pool.
    The FND_JDBC_PLSQL_RESET parameter has been added to only to address the case where production PL/SQL global bugs are known to exist. The performance of the pool is reduced by setting this flag to true.
    Reference : Note 264599.1

    Purpose
    JVM 이 과도한 CPU / Memory를 사용하게 되어 Application Performance에 영향을 미칠때가 있으며 이럴경우 Connection Pool 관련하여 Parameter Tunning을 해야 할때가 있습니다. 이때 사용되는 Parameter들의 의미를 설명하고자 합니다.
    The Applications Database Connection Pool is a pool of JDBC database connections that are shared among java applications. Applications obtain connections from the pool by using the getJDBCConnection(...) methods of AppsContext.
    Essentially, each AppsContext has a single database connection associated with it at all times.
    The AOL/J layer internally borrows and returns this connection to the pool as needed to maintain connection reference that is properly initialized for the current Java tier AOL security context and NLS state.
    FND_MAX_JDBC_CONNECTIONS
    ============================
    The maximum pool size is the maximum allowed sum of the number of available connections and thenumber of locked connections. If the pool reaches the maximum size and all connections are locked, new clients will not be able to borrow a connection until one of the current clients has returned one. The default setting for this parameter is essentially unlimited (about 2 billion).
    FND_JDBC_BUFFER_MIN
    ======================
    The buffer minimum is the minimum number of connections that the pool should try to maintain in the available list. When the buffer size falls below the buffer minimum, the pool maintenance thread will be notified to create new connections. When notified, the thread will immediately attempt to create the number of connections to fill the difference. New connections will not be created if the pool is already at its maximum size. When creating new connections the thread uses the attributes of the most recent client request that resulted in a new connection being created.
    Setting this parameter to "0" will disable maintenance of the buffer minimum.
    However, the buffer maximum will still be maintained.
    Setting this parameter to a number greater than the maximum pool size(FND_MAX_JDBC_CONNECTIONS) will disable all buffer maintenance.
    FND_JDBC_BUFFER_MAX
    ======================
    The buffer maximum is the maximum number of connections that the pool should try to maintain in the available list. During heavy usage, the buffer may exceed this maximum. However, during periods of low usage, the maintenance thread will decrease the buffer size until the buffer maximum is reached.
    If the value of this parameter is an integer, (for example "20") the buffer maximum is static. If the value is a percent (for example, "20%"), the buffer maximum is not constant but instead is calculated dynamically as a percent of total pool size. The buffer minimum is also taken into account when
    determining a dynamic buffer maximum.
    The exact expression used is:
    maximum(t) = buffer minimum + ( (FND_JDBC_BUFFER_MAX/100) * size(t) )
    where maximum(t) and size(t) are the buffer maximum and pool size at some time t.
    The thread is configured to periodically check the buffer size. If the buffer size is greater than the maximum, the thread will remove either the number of available connections specified by FND_JDBC_BUFFER_DECAY_SIZE or the number of connections in excess of the buffer minimum, whichever is smaller. When connections are removed from the available list, the least recently used ones are removed first.
    Setting this parameter to100%, or to a number equal to FND_MAXIMUM_JDBC_CONNECTIONS, or to a number less than or equal to FND_JDBC_BUFFER_MIN will effectively prevent the maintenance thread from ever removing any connections.
    FND_JDBC_BUFFER_DECAY_INTERVAL
    ===================================
    The buffer decay interval specifies how often the connection pool maintenance thread should check the buffer size. The thread will check the buffer size at most once every FND_JDBC_BUFFER_DECAY_INTERVAL seconds. The actual time between consecutive thread cycles will vary somewhat depending on the JVM load.
    This parameter, along with FND_JDBC_BUFFER_DECAY_SIZE, allows the buffer decay rate to be tuned. For example, if the buffer decay size is 2 and the buffer decay interval is one minute, the buffer decay rate will never exceed two connections per minute. When connections are removed, the least recently used ones are removed first.
    FND_JDBC_BUFFER_DECAY_SIZE
    =============================
    The buffer decay size specifies the maximum number of connections that should be removed during any single thread cycle during which the number of available connections is greater than the buffer size. This parameter, along with FND_JDBC_BUFFER_DECAY_INTERVAL, allows the buffer decay rate to be tuned.
    FND_JDBC_MAX_WAIT_TIME
    =========================
    The maximum wait time specifies how much time a client should spend trying to get a connection. The borrow algorithm, used to borrow an object from the pool, contains check points at which the elapsed time is compared to the maximum wait time. If it exceeds the maximum wait time, then a null object will be returned to the client. The pre-configured value for the maximum wait time is
    10 seconds.
    FND_JDBC_SELECTION_POLICY
    ============================
    The selection policy determines how a connection is selected from the list of available connections for a particular client. The connection pool is pre-configured to use a cost-based selection algorithm, which selects the connection that will require the smallest amount of initialization to match the
    client's context.
    FND_JDBC_USABLE_CHECK
    ===========================
    The FND_JDBC_USABLE_CHECK parameter governs whether a pl/sql query is performed before giving a connection to a client. The pool checks whether a connection is usable before handing it to a client. This always involves checking that the connection is not null and is not closed. If FND_JDBC_USABLE_CHECK is set to true, then it also verifies that the connection can be used to perform a simple PL/SQL query. (This parameter may have to be set to "true" in order to clean up
    connections to a database that has been restarted.)
    FND_JDBC_CONTEXT_CHECK
    ==========================
    The FND_JDBC_CONTEXT_CHECK parameter governs whether the AOL security context and NLS state is obtained from the database when the connection is returned to the pool. If FND_JDBC_CONTEXT_CHECK is "true", when the connection is returned to the pool, the AOL security context and NLS state will be obtained from the database. (This is implemented in the DBConnObj.isReusable() method). This check must be done when the connection is returned (rather than when it is borrowed) so that the selection matching algorithm has access to the actual
    session context of the connections in the available list.
    FND_JDBC_PLSQL_RESET
    ========================
    The PL/SQL reset flag, set using the variable FND_JDBC_PLSQL_RESET, governs whether the PL/SQL state associated with a connection should be freed before the pool hands the connection to the client. By default this flag is false.
    If the flag is set by true, by including the line "FND_JDBC_PLSQL_RESET=true" in the .dbc file, each connection to the database will have its PL/SQL state cleared before the pool returns the connection to the client.
    This is how it works. After the pool selects a connection from the available list for a client, it initializes the connection. One of the things initialization does is to set a flag that is later used by SessionManager to determine if the apps initialization routine needs to be performed for the connection. When FND_JDBC_PLSQL_RESET has been set to "true", this flag will always be set to true. After the pool initializes the connection, it also checks whether the connection is usable. In this case, this check will include a call to DBMS_SESSION.RESET_PACKAGE, which frees the PL/SQL state. The table below summaries the affect of FND_JDBC_PLSQL_RESET and the other safety check parameters on borrowing a connection from the pool.
    The FND_JDBC_PLSQL_RESET parameter has been added to only to address the case where production PL/SQL global bugs are known to exist. The performance of the pool is reduced by setting this flag to true.
    Reference : Note 264599.1

  • Connection Pooling in Java Application for interacting with Websphere MQ

    I have following infrastruture at my site.
    1> Machine #1 has below
    - Websphere MQSeries 6.0 (client setup - Slim Client)
    - OS = Windows 2003
    - i/p address : 10.1.11.10
    - Tomcat web server 5.5
    - No Websphere Application Server.
    2> Machine #2 has below
    - Websphere MQSeries 6.0 (Server setup)
    - OS = Windows 2003
    - i/p address : 10.1.11.21
    - Queue Manager Name : qMngr
    - Queue Name (client will put the message) : toServerQ
    - Queue Name (client will get the message) : fromServerQ
    - I have developed the web application in Tomcat web server 5.5 using MQ base classes for accessing the Websphere MQ.
    - Since it is web application there can be atleast 25 request at time.
    i.e. when client#1 request data from queue he must get data related to client#1 only not other than client#1.
    - For accessing the websphere MQ, I am using websphere MQ base classes in Client mode. (Not JMS)
    ==>>>> Source Code as follows
    Class MQInterface (Servlet) is used for getting the web request from user and reply the response in html format.
    public class MQInterface extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    String Output = "";
    System.out.println("!! Entered into Banking Servlet !!");
    String requestParam = request.getParameter("OPRN_CODE");
    if (requestParam.equalsIgnoreCase("GET_NAME_DETAIL")){
         String id = request.getParameter("id");
         Output = MQDataObject().getNameDetail(id);
    return Output;
    response.setContentType("text/html");
         PrintWriter out = response.getWriter();
    out.println(Output);
    Class MQDataObject is used for getting and putting data(message) into Websphere MQ.
    public class MQDataObject {
    private String hostname = "10.1.11.21";
    private String channel = "Chnl1";
    private String qManager = "qMngr1";
    private MQQueueManager qMgr;
    private ISISSSLAdaptor ssl;
    private ISISConfigHelper ConfigHelper;
    private String Output;
    public MQDataObject(){
    MQEnvironment.hostname = hostname;
    MQEnvironment.channel = channel;
    MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_CLIENT);
    MQEnvironment.sslCipherSuite = "SSL_RER_WERH_3KIUD_EQW_CRT_SSA";
    try{
    ssl = new DEMOSSLAdaptor("DEMOSSLAdaptor.config");
    ConfigHelper = new ISISConfigHelper("MQConnection.config");
    }catch(Exception exception){
    System.out.println("Exception Details => " + exception);
    public String getNameDetail(String sendMessage){
    MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES_CLIENT);
         String msgText = "";
         try
    // Create a connection to the Queue Manager.
    qMgr = new MQQueueManager(qManager);
    // Set up the options on the queue we wish to open
    int openOutOptions = MQC.MQOO_OUTPUT;
    // Specify the queue to open and open option      
    MQQueue sendingQueue = qMgr.accessQueue("toServerQ",openOutOptions,null,null,null);
    // Define the MQ message and write some text in UTF format
    MQMessage sendingMessage = new MQMessage();
    sendingMessage.writeUTF(sendMessage);
    // Specify the message options..
    MQPutMessageOptions pmo = new MQPutMessageOptions();
    // Put message on the queue
    sendingQueue.put(sendingMessage,pmo);      
    // Close Sending Queue
    sendingQueue.close();          
    // Receiving the message back
    // Wait for 5 seconds to get reply from receiving queue
    Thread.sleep(5000);
    // Set up the options on receiving queue we wish to open
    int openInOptions = MQC.MQOO_INPUT_AS_Q_DEF | MQC.MQOO_OUTPUT;
    MQQueue receivingQueue = qMgr.accessQueue("fromServerQ",openInOptions,null,null,null);
    MQMessage receivingMessage = new MQMessage();
    // Set and Get the message options
    MQGetMessageOptions gmo = new MQGetMessageOptions();
    // Receiving the message off the queue.
    receivingQueue.get(receivingMessage,gmo);
    // Get the message from the receiving queue.
    msgText = receivingMessage.readStringOfByteLength(receivingMessage.getMessageLength());
    // Close Receiving Queue
    receivingQueue.close();
    // Close a connection to the Queue Manager.
    qMgr.disconnect();
    // Parse the received message using parser.
    String output = new IFXXMLParser().runExample(msgText);
    catch (MQException mqex){
    System.out.println("MQ Error : " + mqex);
    catch (Exception ex){
    System.out.println("General Error : " + ex);
    return Output;
    The message for sending the receiving is in XML format.
    Could any one help me following in questions.
    1> Since there is 30 request at time so for improve the performance and resources I need to do connection pooling.
    How can I achieve this using base classes.
    2> While retrieving (getting) the message for particular request how can I identify the response message.
    i.e. when client#1 request data from queue he must get data related to client#1 only not other than client#1.      
    because In above scenario there are separate queues for getting the message and putting the message.
    I have read the tutorial on connection pulling but I am little confused.
    i.e. default connection pool and MQSimpleConnectionManager.
    Thanking in Advance
    Sanjeev

    RahulSharna wrote:
    Well my advice would be something different here..
    Can you tell us whether the swing application that you are referring could be used by multiple client machines at the sametime ??
    If yes my advice for you would be a costly affair yet effective.
    Think of seperating your DAO layer from the swing client and you can make an attempt to make a centralized tier where DAO and business services are handled (also ensure that we you use connection pooling with a good tranaction support for building that tier).
    Think of publishing those as services either by using remoting tehnologies like RMI,Burlap, Hessian or as a Webservice.
    All you'd do is implementing respective client in the swing or client application which you are referring to..
    (if you things are too wierd and what is the best solution to go about the below url offers a good solution
    [http://tuscany.apache.org/]
    And in doing this you'd ensure there is not toomuch load on the Database and you'd have a centralized location where you can start tracing the problem.My guess would be that since the OP said that they have a server that they do in fact have a server.

Maybe you are looking for

  • Can the iPhoto Library package file be recreated?

    I recently moved my iPhoto library to a new LaCie solid state external hard drive, because it had reached 130GB in size and was taking up too much space on my hard drive. My iPhoto library has 30,000 photos with lots of events, smart albums and metad

  • Questions about upgrade from iphone 3gs to iOS4.

    hello. Anyone of you guys know that if my current 3gs is upgraded to the new iOS4, can all my apps from 3gs be able to work on the new iOS4? Also is the battery features from the iOS4 apply on my current 3gs? thanks!

  • I lose all my cache and add ons after i restart my pc everytime

    i install some add-ons play some online multiplayer games(contract wars,spiral knights) and after i restart my pc,voila,all the add ons and the game cache is gone,i have to load the game again and download the extensions again,and each time i reload

  • Create and schedule iBot to seed cache with  the saved query

    Hi all, May I know how to Create and schedule i Bot to seed cache with the saved query((iBot to run right a daily load to reseed the cache)

  • Idoc Import phrase - error message link to language

    Hi all, I configured an ALE betwenn 2 SAP systems. I received some idocs in oder to import phrase in the target system. When I proccess the idoc i have the following error message: "Cannot create phrase text in source language" and the second one is