When is it appropriate to use DataSource (or Connection pooling)?

Hello all,
I'm having some design issues with my application and I'm starting to think that maybe using Connection pooling is not suited for my application. I'm using Tomcat 5.5.12 if it's any relevant..
The architecture of our application looks like this:
Servlets -> App Helper classes -> DB/Accessor classes
looks like the three-tier architecture described in this document: http://www.subrahmanyam.com/articles/servlets/ServletIssues.html
I have read on the Tomcat docs that said that using DataSource is good practice and improves efficiency since it recycles database connections. However, if the accessor/DB classes are not servlets, how can I use the DataSource facility that interacts with Tomcat?
I would like to know whether it is a good idea to use DataSource in my case and if so, how? (since they are not servlets)
Thanks in advance :)

Hi. Thank you for replying.
In the examples that I've seen that use JNDI for Database access, it seems that DataSource is always used--in other words, JNDI and DataSource always seem to be used together (in Servlets). I have not found a case where JNDI is used by itself to access the Database--perhaps I'm not looking in the right place. Could you point me to some documentation maybe?
Thanks a lot!

Similar Messages

  • When is it appropriate to use a servlet in a JSP/JSF environment?

    I have inherited a fairly old JSP-based application. I know that I need to update its technologies, in particular the use of AJAX so that I don't need to keep refreshing the page each time I want more data from the server. The problem is that I don't know a great deal about other technologies. There seem to be so many conflicting opinions about the way to go regarding servlets and JSP and JSF (and possibly JavaBeans). I am probably going to start using JSF and AJAX. I mention this to give you some background info. My real question is: when is best/appropriate to use a servlet? From what I have seen I do not want to use a servlet for generating HTML output - that seem just so last decade! But do they still have a good use over more modern technologies? Also, when is it appropriate to use JavaBeans? Are JavaBeans a thing of the past (or just plain inappropriate) for web applications?
    Regards,

    I suggest going to the bookstore and looking for a book on JSF and reading it cover to cover. It may tell you where servlets come into the picture (if at all). I suggest paying attention to MVC design that it discusses, and working through the examples before working on your project (assuming you have the time). Then creating a simple project and refactor it over and over to meet MVC.
    For your project, I suggest just doing ONE JSF page (and its underlying database access) and refactor it over and over again (MVC) before doing the other JSF pages. This way, you dont have to refactor 34 JSF pages to correct the same mistake appearing in all the pages (saves a LOT of time).
    I don't know enough about AJAX to really comment on it. However, I would ask myself if refreshing the JSF page is really enough of a concern for your end-users to make it worth while to use AJAX on this project.

  • DataSource Vs Connection Pooling

    What is the difference between Datasource and Connection Pool, and what is the advantages of using both.can any one plz explain me..

    Hi,
    Without creating a Connection Pool, one can not create a Data Source.
    Connection Pool refers to the DataBase URL, Driver Class, User-Id and Password for the database.
    Data Source refers to the Connection Pool created above for the particular database.
    And to get connection from the DataSource:
    DataSource ds = (javax.sql.DataSource)initCtx.lookup("JNDI-NAME");
    Connection conn = ds.getConnection();
    sameer

  • Difference between Datasource and Connection Pool

    Hi,
    What is the major difference between Datasource and Connection Pool.
    Both the Datasource with JNDI and Connectio Pool will serve the pool of connections. Then what is the difference.
    regards,
    Raj

    A datasource is not implicitly a connection pool. You can configure that in the datasource properties. A connection pool is also not implicitly a datasource. You can create your own connection pool using the java.sql interfaces. A datasource just gives the ability to acquire the connections and access the database through JNDI. A connection pool just gives the ability to reuse a set of connections which are created/closed/controlled by the connection pool logic.

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

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

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

  • How to use a JCO connection pool in an EJB?

    Hi *,
    I want to build a WebService using SAP Web AS (J2EE Engine) that connects to a R/3 ERP (release 4.7).
    I thought of building a stateless session bean that will be deployed as webservice. The session bean shall connect to the R/3 in order to call some BAPIs. I'd like to use a JCO connection pool. But I'm not sure, where I should create and destroy the connection pool. Are the EJB methods ejbCreate() and ejbRemove() the right ones? If so, my businness methods would just have to get a connection from the pool and call the BAPIs, right? If not, what do you suggest?
    Another question: I already deployed a bean as webservice. Since not really knowing how to use the connection pool, I created a bean with one business method that creates a connection pool whenever it gets called. But if I have to change something in the bean so that I have to redeploy the bean I can't call my business method anymore, because JCO cannot load a native library once again, as it is already loaded, This leads to an exception. So I have to restart the complete engine everytime I redeploy my bean. Are there any workarounds for this problem? I'm not sure whether this is connected to the wrong use of the JCO connection pool.
    Kind regards,
    Lars

    Hi *,
    I want to build a WebService using SAP Web AS (J2EE Engine) that connects to a R/3 ERP (release 4.7).
    I thought of building a stateless session bean that will be deployed as webservice. The session bean shall connect to the R/3 in order to call some BAPIs. I'd like to use a JCO connection pool. But I'm not sure, where I should create and destroy the connection pool. Are the EJB methods ejbCreate() and ejbRemove() the right ones? If so, my businness methods would just have to get a connection from the pool and call the BAPIs, right? If not, what do you suggest?
    Another question: I already deployed a bean as webservice. Since not really knowing how to use the connection pool, I created a bean with one business method that creates a connection pool whenever it gets called. But if I have to change something in the bean so that I have to redeploy the bean I can't call my business method anymore, because JCO cannot load a native library once again, as it is already loaded, This leads to an exception. So I have to restart the complete engine everytime I redeploy my bean. Are there any workarounds for this problem? I'm not sure whether this is connected to the wrong use of the JCO connection pool.
    Kind regards,
    Lars

  • Using Database Resident Connection Pooling

    Hi all,
    <br><br>
    In trying to use Database Resident Connection Pooling in Oracle 11g, here is what I have done:
    <br><br>
    SQL> conn / as sysdba
    Connected.
    SQL> exec DBMS_CONNECTION_POOL.START_POOL();
    PL/SQL procedure successfully completed.
    SQL> SELECT STATUS,MINSIZE,MAXSIZE,INCRSIZE,SESSION_CACHED_CURSORS,INACTIVITY_TI
    MEOUT
      2  FROM DBA_CPOOL_INFO;
    STATUS              MINSIZE    MAXSIZE   INCRSIZE SESSION_CACHED_CURSORS
    INACTIVITY_TIMEOUT
    ACTIVE                    4         40          2                     20
                   300<br>
    <br>
    In tnsnames.ora file, here is what I have put:<br>
    ORA11G =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = winxp)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = DEDICATED)
          (SERVICE_NAME = ora11g)
    ORA11GP =
      (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = winxp)(PORT = 1521))
        (CONNECT_DATA =
          (SERVER = POOLED)
          (SERVICE_NAME = ora11g)
      )<br>
    <br>
    Now, in sqlplus in attempt to use DRCP, here is what I got:<br>
    SQL> CONN HR/HR@ORA11G
    Connected.
    SQL> CONN HR/HR@ORA11GP
    ERROR:
    ORA-28547: connection to server failed, probable Oracle Net admin error
    Warning: You are no longer connected to ORACLE.<br>
    <b>Is there anything I missed to properly use DRCP.</b>
    <br>
    Thanks in advance.

    According to Metalink note:
    Subject: Using DRCP and NTS Authentication Results in ORA-28547
    Doc ID: Note:563943.1 Type: PROBLEM
    Last Revision Date: 19-MAY-2008 Status: MODERATED
    this is a bug on Windows and you should configure client sqlnet.ora so that SQLNET.AUTHENTICATION_SERVICES=NONE.

  • What about session memory when using BEA Weblogic connection pooling?

    Hi,
    consider a web application, allowing database connections via a BEA Weblogic 8.1 application server. The app-server is pooling the oracle connections. The oracle database is running in dedicated server mode.
    How are the database requests from the web app served by the connection pool from BEA?
    1) Does one oracle session serve more than one request simultanously?
    2) Does BEA serialize the requests, which means, that a session from the pool is always serving only one request at a time?
    If (1) is true, than what about the session memory of Oracle sessions? I understand, that things like package global variables are beeing stored in this session private memory. If (1) is true, the PL/SQL programmer has the same situation, as with programming an Oracle databas in "shared server" mode, that is, he should not use package global variables etc.
    Thankful for any ideas...
    Message was edited by:
    Xenofon

    Xenofon Grigoriadis wrote:
    Hi,
    consider a web application, using BEA between client and an Oracle Database (v9i). BEA is pooling the oracle connections. The oracle database is running in dedicated server mode.
    How are the database requests from the web app beeing served by the connection pool from BEA?
    1) Does one oracle session serve more than one request simultanously?no.
    2) Or does BEA serialize the requests, which means, that a session from the pool is always serving only one request at a time?
    Reading "Configuring and Using WebLogic JDBC" from weblogic8.1 documentation, I read:
    "... Your application "borrows" a connection from the pool, uses it, then returns it to the pool by closing it...."
    What do you mean by returning the connection by closing it? Tbe server will either return the connection to the pool or close it...When application code does typical jdbc code, it obtains
    a connection via a WebLogic DataSource, which reserves an
    unused pooled connection and passes it (transparently wrapped)
    to the application. The application uses it, and then closes
    it. WebLogic intercepts the close() call via the wrapper, and
    puts the DBMS connection back into the WebLogic pool.
    The reason, why I as an Oracle programmer ask this is, because every session (=connection)
    in Oracle has its own dedicate, private memory for things like global PL/SQL variables.
    Now I want to figure out, if you have to careful in programming your databases, when
    one Oracle session (=connection) is serving many weblogic requests.It is serving many requests, but always serially. Do note however, that we
    also transparently cache/pool prepared and callable statements with the
    connection so repeat uses of the connection will be able to get already-made
    statements when they call prepareStatement() and prepareCall(). These
    long-lived statements will each require a DBMS-side cursor.
    >
    Thankful for any ideas or practical experience...
    Message was edited by:
    mk637Joe

  • How to use datasources to connect to database ?

    I have the following Problem
    I have two identical databases, one is the development database, the other one the production database.
    Now I need to find a way, how I can deploy an bc4j-application in local mode that way, that if the application is deployed to server 1 it connects to database 1 and if deployed to server 2 it connects to database 2.
    JDBC connection strings do not work as the connection is deployed with the application. So the application always connects to the same database.
    I thought datasources might be the solution. So I tried to define a datasource MyDS in the data-sources.xml file and specified it in the Configuration Wizard as the connection to use.
    But unfortunately this does not work and i do not know why:
    If I try to connect using the tester and using this datasource I get the following exception:
    Level #3: javax.naming.noInitialContextException
    Can anyone help me, what this means? How can I get around this using the BC4J Framework? Is there any "HowTo" Document which describes using datasources with BC4J?

    Frank,
    I've sorted this stuff out to some extent. Have a look at this thread:
    re:? How: multiple myAppWar.ear to use OC4J's data-sources.xml pooling?
    If this isn't all you need, then search on data-source.xml
    and read other threads also I may have posted helps on
    other threads so if you search on data-source.xml and my handle (curt504) it brings up all the threads that I posted to.
    Not to say I've solved all your problems, but I solved mine anyway. :)
    Good luck,
    curt

  • Which DataSource class to use for DB connection pooling?

    Hi,
    can someone point me in the direction of some (sample?working?) data-sources.xml configurations that pool the DB connections please. I don't have a requirement for TPC, so either native or emulated would be fine, but I need a LOT less db connections for multiple users using stateless sessions on the same database/datasource than I am currently getting. An added bonus would be being able to use the "Monitor Performance" button in Enterprise Manager.
    thanks
    Brigette

    data-sources.xml configurations that pool the DB connections
    Define a data source connection pool with a data-source element in data-sources.xml file.
    <data-source
         class="oracle.jdbc.pool.OracleConnectionPoolDataSource"
              name="OracleDS"
              location="jdbc/OracleDS"
              xa-location="jdbc/xa/OracleXADS"
              ejb-location="jdbc/OracleDS"
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username=""
              password=""
         url="jdbc:oracle:thin:@<host>:<port>:<SID>"
              inactivity-timeout="30"
         />

  • Some doubts in using resource-ref,connection pool n Data-source

    Hi all ,
    I need little bit clarification in the following points.
    1) Does the connection pool which is created can be displayed in JNDI Tree???
    I am seeing only DataSOurce in the JNDI Tree Only.
    2)In case of Bean Managed Persistance, in ejb-jar.xml,
    I had given the following info.
    <resource-ref>
             <res-ref-name>ramukkDataSource</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
         </resource-ref>Does the <res-ref-name> refers to Datasource Name??
    In weblogic-ejb-jar.xml
    <reference-descriptor>
           <resource-description>
              <res-ref-name>ramukkDataSource</res-ref-name>
              <jndi-name>ramukkpool</jndi-name>
           </resource-description>
         </reference-descriptor>Here <jndi-name> refers to connection pool as per weblogic bible book.
    If so when i deployed my ejb into the server iam getting Datasource cant be found.
    If i had given like the following,
    In ejb-jar.xml
    <resource-ref>
              <res-ref-name>jdbc/ramuJndi</res-ref-name>
              <res-type>javax.sql.DataSource</res-type>
              <res-auth>Container</res-auth>
         </resource-ref> In weblogic-ejb-jar.xml
         <reference-descriptor>
              <resource-description>
               <res-ref-name>jdbc/ramuJndi</res-ref-name>
               <jndi-name>jdbc/ramuJndi</jndi-name>
           </resource-description>
        </reference-descriptor>Then only my ejb code is successfully deploying doing some work which is as per xpectation.
    Can any body tell why I have to give the same name for <res-ref-name> n <jndi-name>??
    I am working on this problem from last one week. Still not found the solution.
    Connection Pool Creation
    GENERAL::
    Name : ramukkpool
    url : jdbc:mysql://localhost:3306/test
    Driver Classname: com.mysql.jdbc.Driver
    Properties :
    user = root
    Password = XXX
    create
    TARGETS::
    i had shifted myServer from left side to right side n clicked >>Apply
    (Techncially can we say this as deploying the connection pool into server ???????????
    If not how to deploy the connection pool into server??)
    I did not get any errors in the console.
    Now i am creating a datasource
    CONFIGURATION:
    Name : ramukkDataSource
    JNDIName: jdbc/ramuJndi(Does we have to follow this convention only?? i.e JNDIName should start with jdbc/ only)
    PoolName: ramukkpool
    create
    TARGETS::
    I had shifed myServer from left to right n >>Apply.
    Now also i did not get any errors in the console.Thanx(in advance),
    ramu

    I have read the documentation.
    I changed my class to oracle.jdbc.pool.OracleConnectionCacheImpl from
    oracle.jdbc.pool.OracleConnectionPoolDataSource
    I observed in the EM that the Open JDBC Connections and Total JDBC Connections are the same. When I used oracle.jdbc.pool.OracleConnectionPoolDataSource my Total JDBC Connections was increasing and Open JDBC Connections remains 0.
    My question still remains unanswered, could some kindly help.
    Q? I have defined a data source in JDeveloper using
    oracle.jdbc.pool.OracleConnectionCacheImpl
    In my java bean I am using the code pasted below to make a connection to database.
    Can some one tell whether I am using the correct method of connection pooling mechanism or do I need to make some changes? This application uses JSP and used by lots of people which hits database very frequently.
    Any help is highly appreciable.
    Thanks in advance.
    *******Code to make connection*********
    private javax.naming.InitialContext context = null;
    private javax.sql.DataSource jdbcURL = null;
    private static final String url = "jdbc/ProdCoreDS";
    public boolean openConnection()
    try
        DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    context = new javax.naming.InitialContext();
    jdbcURL = (javax.sql.DataSource)context.lookup(url);
    con =  jdbcURL.getConnection();
    return true;
      catch(Exception e)
           System.out.println("Error in the Connection  "+e);
        e.printStackTrace();
                 return false;
         }}

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

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

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

  • Read data using 2 diff connection pool for same DB folder in physical layer

    Hi All,
    i am using two connection pool which have different dsn connection information (both are directed to different database name or database server)..
    so if i view the data of any table, a prompt will come asking for the connection pool, so how do i automize it....?
    how do i set the different connection pool for different tables?
    please let me know if u need further informtaion to understand my problem..
    thnx...

    thnx Stijn..
    yupe that i know...
    actually i have total of around 300 tables in physical layer (in both the schemas..) , around 12 fact and 100 dimension tables in bmm and same in the presentation layer...
    so i think u can guess how many joins and other stuff, i have made in my bmm layer..
    if now i will start modifying all this it will take lot of time...
    i am just wondering that there is no alternative for this...
    as when i check my data from the physical layer then a prompt ask for the connection pool (i have already made two connection pool..) so there could be some alternative way to automize the default connection pool setting for the tables/schemas folders in case if more than one connection pool exits under the same database in the physical layer...
    isn't it?
    thnx again..

  • VARRAY mapping issues using WLS spk2 connection pools

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

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

  • How can i know the no .of  connections are used in the connection pool

    Hi
    I am using tomcat connection pool in my project .but how can i know how many connections are used by my project .how can i know how many connections are used plez help me

    You mean INSIDE the webapp, using the Admin Console (tomcat docs should be helpful in that case)... Where are you supposed to search for the info?

Maybe you are looking for

  • Text Vibrate Setting

    On the Iphone 4, if normal ringtone set for phone, can texting be set to vibrate only and not create tone?

  • Quicktime Restarts Computer, Has NO Audio

    Quicktime Restarts Computer, Has NO Audio Quicktime  7.7.2 Restarts Computer. Summary: 1.     Change the setting so the Computer does NOT Restart on Error. 2.     Update the Video Driver. See article on how to change the setting so the computer will

  • RFC comparing Purchase Order from server D10 and compare the PO E10 server

    Hi Gurus, I want to fetch data of Purchase order from D10 system client 058 and compare whether the same Purchaser order is also present in E10 system clilent 078. Please send me the sample code how to retrieve the code from different servers using R

  • Iframe 2 targets for 1 link (sorry to insist)

    That's is my very simple example code: <p><a href="menuiframe.html" target="menu">menu1</a></p> <p><a href="menuiframe2.html" target="menu">menu2</a></p> <p> </p> <p> </p> <iframe src="" name="menu" width="200" height="200" align="left" id="menu"><br

  • Photo delivery help

    HI, I recently shot some photos at a friends wedding in RAW and edited them using CS6. The pictures are about 35GB in total. They are currently saved as .psd files. What is the best method to give her the pictures? I don't want to lose the resolution