I don�t understand those connection pools?

Does anyone have a really clear example on how to set up a connection pool in my controler Servlet's init() method, and how I can access that pool, and pick up a connection from within my dbConnect Bean. If this is not a proper setup, please comment. Because I'm lost.
I've been struggling for a while with setting up a pool, and used the com.javaexchange.dbConnectionBroker package. It is possible to make my dbConnect bean a servlet, and make it the supercalss of my controler, so the controler inherits the global pool. But can I call methods in the dbConnect servlet from my controler servlet?
I just want to have some input before I throw the entire thing around again.

Create a servlet that will instantiate dbConnectionbroker or whatever connection pool. Initalize list of connection thru that and load it. And then pre-load this servlet in servlet container.
To access or get a connection from pool, get pre loaded servlet from conatainer and then get instance of connection pool manager and then get the connection from it.
I hope this works for you....
chao

Similar Messages

  • Don't Understand Wireless connection

    If anyone can give me expert advice it would be greatly appreciated. I just received my new macbook but i don't know how to connect to the internet wirelessly? Do i need to buy an airport express or w/e it is? I connected to the internet by using my home computer's DSL Modem and connecting it to the macbook. But how do i connect wirelessly? THank you for your help.

    Just to clarify, you don't have to buy an 802.11g router; an 802.11b router will also work..... although, buying anything that is solely 802.11b nowadays is pointless, as 802.11g equipment is just as accessible and closely priced.
    In fact, it's those people out there that buy equipment (mainly the wireless NICs) that's only 802.11b compatible that hurt the progress of wireless technology, i.e., 802.11g being prominent. If 802.11b clients connect to 802.11g access points, they significantly lower the amount of bandwidth available to other clients... FYI.

  • Two Connection Pools In One Database With Two Phisical Schema

    I have a database with 2 physical schemas. Each physical schema has a different username and password. So i must create a second connection pool. But i have the problem that physical schemas don't understand which connection pool to use. How can i coincide each physical schema to its connection pool automatically.
    Regards

    You need two Physical databases each with its own Connection Pool, within that database will be a single Physical Schema.
    Or you could have a single Database/Connection Pool if it has read access to both schemas.

  • MySQL connection pooling (tomcat) problem

    Hi all i just started learning servlets and i want to make a program in order to understand database connection pooling in tomcat.My problem is that when i run the servlet i created i get this error :
    java.lang.NullPointerException org.DB.TestDB2.doGet(TestDB2.java:105) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
    And that from tomcat log from netbeans :
    org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' 
    .I configured tomcat server.xml file like this :
    <Context path="/DBTest" docBase="DBTest"         debug="5" reloadable="true" crossContext="true">   <Resource name="jdbc/phonebook_db" auth="Container" type="javax.sql.DataSource"               maxActive="100" maxIdle="30" maxWait="10000"               username="*******" password="********" removeAbandoned="true"               removeAbandonedTimeout="120" driverClassName="com.mysql.jdbc.Driver"               url="jdbc:mysql://localhost:3306/test_phonebook_db?autoReconnect=true"/> </Context>   
    This is the resource reference i have in my web app web.xml file :
    <resource-ref>       <description>DB Connection</description>       <res-ref-name>jdbc/phonebook_db</res-ref-name>       <res-type>javax.sql.DataSource</res-type>       <res-auth>Container</res-auth>   </resource-ref> 
    And this is my servlet class :
    package org.DB;  import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import java.sql.*; import javax.naming.*; import javax.sql.*; public class TestDB2 extends HttpServlet { private Connection conn ; private Statement stat ; private ResultSet rs ; private int counter; private Object rsValue; public void init() {     try {             InitialContext ctx = new InitialContext();             DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/phonebook_db");             conn = ds.getConnection();             }         catch(Exception e) {               e.printStackTrace();         }     }     public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {         try {           stat = conn.createStatement();           rs = stat.executeQuery("SELECT * FROM phones_table");            } catch (SQLException sqle) {         sqle.printStackTrace();         }      response.setContentType("text/html; charset=utf-8");     PrintWriter out = response.getWriter();         String docType = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " + "Transitional//EN\">\n";     out.println(docType +"<HTML>\n" + "<HEAD><TITLE>PhoneBook entries</TITLE></HEAD>\n");         counter = 0;     try {         while (rs.next()) {             out.println("<h4>Entry no. " + (++counter) + "</h4>");             out.println("<table width=\"75%\" border=\"1\">");             out.println("<tr>\n"+ "<td width=\21%\"><b>LastName:</b></td>\n"+ "<td width=\"79%\">");             out.println((((rsValue = rs.getObject("LASTNAME"))==null || rs.wasNull())?                 "":(rsValue.toString())));             out.println("</td>\n</tr>\n" +  "<tr>\n"+                     "<td width=\21%\"><b>FirstName:</b></td>\n"+ "<td width=\"79%\">");             out.println((((rsValue = rs.getObject("FIRSTNAME"))==null || rs.wasNull())?                 "":(rsValue.toString())));             out.println("</td>\n"+ "</tr>\n"+                     "<td width=\21%\"><b>Phone:</b></td>\n"+ "<td width=\"79%\">");             out.println((((rsValue = rs.getObject("PHONE"))==null || rs.wasNull())?                 "":(rsValue.toString())));             out.println("</td>\n" + "</tr>\n" +                     "</table>\n"+ "<br>\n<br>");         }     } catch (SQLException sqle) {         sqle.printStackTrace();     }     out.println("</body>\n"+             "</html>"); } public void destroy() {     try {         rs.close();         stat.close();         conn.close();     } catch (SQLException sqle) {         sqle.printStackTrace();         }     } }{code} Any suggestions?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Thank you for your answer.Yes my servlet class is something more worse than horrible(i don't use the database connection correct i don't use the MVC pattern i use out.println() ) but i just tried to take a ready example and try to understand .So i write this servlet myself as a starting point :
    package org.DB;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.*;
    import java.sql.*;
    public class DBServlet extends HttpServlet {
        private Connection conn ;
        private Statement stat ;
        private ResultSet rs ;
        private int counter;
        String driver = "com.mysql.jdbc.Driver";
        String dbURL = "jdbc:mysql://localhost:3306/phonebookdb?user=**********&password=************";
        @Override
    public void init() {
         try {
                Class.forName(driver).newInstance();
                conn = DriverManager.getConnection(dbURL);
         }catch(Exception e) {
                  e.printStackTrace();
                  System.err.print("Unable to make connection ");
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            try {
                out.println("<html>");
                out.println("<head>");
                out.println("<title>Servlet DBServlet</title>"); 
                out.println("</head>");
                out.println("<body>");
                out.println("<h1>Servlet DBServlet at " + request.getContextPath () + "</h1>");
                out.println("<br /><br /><br />");
                if(conn!=null) 
                    out.println("conn object : "+conn);
                out.println("</body>");
                out.println("</html>");
            } catch(Exception sq) {
                System.out.println("Exception" + sq.getMessage());
                out.close();
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
         public void destroy() {
         try {
             conn.close();
         } catch (SQLException sqle) {
             sqle.printStackTrace();
        @Override
        public String getServletInfo() {
            return "A Simple Servlet";
    }And it work for now.
    Edited by: pavlos555 on Oct 21, 2008 10:21 AM

  • Calculation of no of connection pools required...

    hi,
    1. How many connections can a connection pool have? is there any upper limit on it?
    2. How do we calculate how many connection pools we need for good performance in our OBIEE system.
    3. Currently my client have plans to launch this application for 5,000 users and later after few months the same application will be opened for 70,000 users. So how should i calculate the number of connection pools required so that all the users can acces the Dashboard without feeling much network traffic (assuming all the users are logged in same time)
    Any suggestions guys?

    Hi Abhi,
    To calculate maximum no of connections go through the gerard nico link that Srikanth has provided.Generally for init blocks and report queries we creat diffrent connection pools.
    No of connection pools and max no of connections should be carefully chosen because BI server will allocate memory to these connection even if you are not using those connection pools.Total no of connections in RPD should be less than 800.This is an Oracle recommnedation.
    Regards,
    Sandeep

  • My ipod touch 2nd gen wont connect to the internet. I don't understand how to find out the WEP or anything.

    I've had my ipod touch for a while now but I cannot conect to the internet anywhere except the apple shop. I've been in there and they said it was fine as it connected to their open wi-fi without a problem. I have access at home to wi-fi and I can also get BTopenzone on my laptop. I don't understand the settings things so I need help please  

    Try the following:
    - Reset the iPod:
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    -Power off and thn back on the router
    - Reset network settings: Settings>General>Reset: Reset Networks Settings
    - The troubleshooting here:
    iPhone and iPod touch: Troubleshooting Wi-Fi networks and connections
    - As a test, configure you network/router to use no security,

  • I have done the softer update and now this system request a connection with a meanie HD and I connector for iTunes I don't understand why ?

    I have done the softer update and now this system request a connection with a Mini  HDMI  connector for iTunes I don't understand why ?
    DO I HAVE TO HAVE THE MINI HDMI CONNECTOR TO COMPLETE THE SOFTER UPDATE PROCESS ?

    You might be seeing a Micro USB cable (Not HDMI) that is because your Apple Tv is in Recovery Mode due to some reason and it needs to be Restored by connecting it to iTunes on your Computer. So if you have a Micro USB cable ( which comes with Android Smart Phones ) then try to connect your Apple Tv to your computer using the same and with the help of iTunes Restore your Apple Tv to Factory Settings. Go through the below Apple Support kb which says " If your Apple TV still does not respond or if you were unable to follow the above steps "
    http://support.apple.com/kb/ht4367

  • Can admin.jar create oc4j users and connection pools that use those users

    Hi
    I have an ADF BC application written in jdev 10.1.3.3 deployed to standalone oc4j 10.1.3
    When I deploy the application I use the enterprise manager to create the users on the security provider/realms tab. I then set up the connection pools in jdbc resources to use those users via the username and indirect password fields. I also set the minimum number of connections on the attributes tab.
    I have read the following document but I cannot find any reference to setting up users, connection pools with indirect passwords or minimum number of connections.
    http://download-uk.oracle.com/docs/cd/B31017_01/web.1013/b28950/adminclient.htm#BABHJAFE
    Is it possible to do using admin.jar?
    thanks
    paul schweiger

    I'm not sure about setting indirect passwords on the connection pool creation -- never tried it. It's probably treated purely as a lexical string, so may well be able to to issue the CP creation command with the "->USER" entry as the password.
    To create realms, users, groups, etc. you need to use the $ORACLE_HOME/j2ee/home/jazn.jar utility: http://download.oracle.com/docs/cd/B25221_04/web.1013/b14429/admintool.htm#g1022417
    The options for connection pool parameters such as min/max connections aren't directly expressable in the command. I'll need to look at the code and see if they can be passed in as non checked options via the factoryproperties. If not, then you can create a JMX client to use the MBeans that are created for the CP post deployment to change its behaviour.
    -steve-

  • HT1695 my ipad2 will not connect to the internet, it says that it "unable to join"...but my laptop is connected to the internet.... i don't understand why all of a sudden it stopped connecting it dosent make sense

    my ipad2 will not connect to the internet, it says that it "unable to join"...but my laptop is connected to the internet.... i don't understand why all of a sudden it stopped connecting it dosent make sense.

    hmm, well I would say that raises the possibility of an issue with your ipad, and lessens one with your router.
    What version iOS are you using? Update
    Then Its time to try a restore.
    How to update your iOS device
    http://support.apple.com/kb/HT4623
    How to back up and restore (iCloud and iTunes)
    http://support.apple.com/kb/HT1766

  • HT1212 i have lost my password and been trying to restore but don't understand way it never get completed(my ipad3 gets on between the process and itunes reminds me that the device is passcode protected so it can't be connected and then the download also

    after attempting many worng passwords my ipad atlast ask me to connect to the itunes and there is't any other option it is showing on it , and don't have the backup of my ipad on my pc so search the net and got the answer to restore it ......
    i have lost my password and been trying to restore but don't understand way it never get completed(my ipad3 gets on between the process and itunes reminds me that the device is passcode protected so it can't be connected and then the download also stops) some times at 500mb and even at 700mb
    please if some one know the sloution
    help me
    thanks
    its ipad 3

    Follow these instructions to resolve a forgotten passcode:
    http://support.apple.com/kb/HT1212

  • How is connection pooling done in ias ?

    is it the "DataSource Registration' ->'DataSource Pool' ->'MaxPoolSize' or is it 'Data Access Driver'-> 'Cache'-> 'Maximum Connections'
    or is it somewhere else ?

    The connection pool settings for a particular datasource should be done in Datasource Pool-> MaxPoolSize.
    The Driver-> Maximum Connections is the maximum no. of connections to the particular database.
    Note the difference between these two, two different datasources could connect to a database using the same database driver.
    Hope this helps.
    Thanks,
    Rakesh.

  • Connection pooling and auditing on an oracle database

    Integration of a weblogic application with an oracle backend,
    Connection pooling, and auditing ,2 conflicting requirements ?
    Problem statement :
    We are in the process of maintaining a legacy client server application where
    the client is
    written in PowerBuilder and the backend is using an Oracle database.
    Almost all business logic is implemented in stored procedures on the database.
    When working in client/server mode ,1 PowerBuilder User has a one-to-one relation
    with
    a connection(session) on the oracle database.
    It is a requirement that the database administrator must see the real user connected
    to the database
    and NOT some kind of superuser, therefore in the PowerBuilder app each user connects
    to the database
    with his own username.(Each user is configured on the database via a seperate
    powerbuilder security app).
    For the PowerBuilder app all is fine and this app can maintain conversional state(setting
    and
    reading of global variables in oracle packages).
    The management is pushing for web-based application where we will be using bea
    weblogic appserver(J2EE based).
    We have build an business app which is web-based and accessing the same oracle
    backend app as
    the PowerBuilder app is doing.
    The first version of this web-based app is using a custom build connector(based
    on JCA standard and
    derived from a template provided by the weblogic integration installation).
    This custom build connector is essentially a combination of a custom realm in
    weblogic terms
    and a degraded connection pool , where each web session(browser) has a one-to-one
    relation
    with the back end database.
    The reason that this custom connector is combining the security functionality
    and the pooling
    functionality , is because each user must be authenticated against the oracle
    database(security requirement)
    and NOT against a LDAP server, and we are using a statefull backend(oracle packages)
    which would make it
    difficult to reuse connections.
    A problem that surfaced while doing heavy loadtesting with the custom connector,
    is that sometimes connections are closed and new ones made in the midst of a transaction.
    If you imagine a scenario where a session bean creates a business entity ,and
    the session bean
    calls 1 entity bean for the header and 1 entity bean for the detail, then the
    header and detail
    must be created in the same transaction AND with the same connection(there is
    a parent-child relationship
    between header and detail enforced on the back end database via Primary and Foreing
    Keys).
    We have not yet found why weblogic is closing the connection!
    A second problem that we are experincing with the custom connector, is the use
    of CMP(container managed persistence)
    within entity beans.
    The J2EE developers state that the use of CMP decreases the develoment time and
    thus also maintenance costs.
    We have not yet found a way to integrate a custom connector with the CMP persistence
    scheme !
    In order to solve our loadtesting and CMP persistence problems i was asked to
    come up with a solution
    which should not use a custom connector,but use standard connection pools from
    weblogic.
    To resolve the authentication problem on weblogic i could make a custom realm
    which connects to the
    backend database with the username and password, and if the connection is ok ,
    i could consider this
    user as authenticated in weblogic.
    That still leaves me with the problem of auditing and pooling.
    If i were to use a standard connection pool,then all transaction made in the oracle
    database
    would be done by a pool user or super user, a solution which will be rejected
    by our local security officer,
    because you can not see which real user made a transaction in the database.
    I could still use the connection pool and in the application , advise the application
    developers
    to set an oracle package variable with the real user, then on arrival of the request
    in the database,
    the logic could use this package variable to set the transaction user.
    There are still problems with this approach :
    - The administrator of the database can still not see who is connected , he will
    only see the superuser connection.
    - This scheme can not be used when you want to use CMP persistence , since it
    is weblogic who will generate the code
    to access the database.
    I thought i had a solution when oracle provided us with a connection pool known
    as OracleOCIConnectionPool
    where there is a connection made by a superuser, but where sessions are multiplexed
    over this physical pipe with the real user.
    I can not seem to properly integrate this OCI connectionpool into weblogic.
    When using this pool , and we are coming into a bean (session or entity bean)
    weblogic is wrapping
    this pool with it's own internal Datasource and giving me back a connection of
    the superuser, but not one for the real user,
    thus setting me with my back to the wall again.
    I would appreciate if anyone had experienced the same problem to share a possible
    solution with us
    in order to satisfy all requirements(security,auditing,CMP).
    Many Thanks
    Blyau Gino
    [email protected]

    Hi Blyau,
    As Joe has already provided some technical advice,
    I'll try to say something on engineering process level.
    While migrating an application from one technology to
    other, like client-server to n-tier in you case, customers and
    stakeholders want to push into the new system as many old
    requirements as possible. This approach is AKA "we must
    have ALL of the features of the old system". Mostly it happens
    because they don't know what they want. Ad little understanding
    of abilities of the new technology, and you will get a requirement
    like the one you have in you hands.
    I think "DBA must see real user" is one of those. For this
    type of requirements it can make sense to try to drop it,
    or to understand its nature and suggest alternatives. In this
    particular case it can be a system that logs user names,
    login and logout times.
    Blind copying of old features into an incompatible new architecture
    may endanger the whole project and can result in its failure.
    Hope this helps.
    Regards,
    Slava Imeshev
    "Blyau Gino" <[email protected]> wrote in message
    news:[email protected]...
    >
    Integration of a weblogic application with an oracle backend,
    Connection pooling, and auditing ,2 conflicting requirements ?
    Problem statement :
    We are in the process of maintaining a legacy client server applicationwhere
    the client is
    written in PowerBuilder and the backend is using an Oracle database.
    Almost all business logic is implemented in stored procedures on thedatabase.
    When working in client/server mode ,1 PowerBuilder User has a one-to-onerelation
    with
    a connection(session) on the oracle database.
    It is a requirement that the database administrator must see the real userconnected
    to the database
    and NOT some kind of superuser, therefore in the PowerBuilder app eachuser connects
    to the database
    with his own username.(Each user is configured on the database via aseperate
    powerbuilder security app).
    For the PowerBuilder app all is fine and this app can maintainconversional state(setting
    and
    reading of global variables in oracle packages).
    The management is pushing for web-based application where we will be usingbea
    weblogic appserver(J2EE based).
    We have build an business app which is web-based and accessing the sameoracle
    backend app as
    the PowerBuilder app is doing.
    The first version of this web-based app is using a custom buildconnector(based
    on JCA standard and
    derived from a template provided by the weblogic integrationinstallation).
    This custom build connector is essentially a combination of a custom realmin
    weblogic terms
    and a degraded connection pool , where each web session(browser) has aone-to-one
    relation
    with the back end database.
    The reason that this custom connector is combining the securityfunctionality
    and the pooling
    functionality , is because each user must be authenticated against theoracle
    database(security requirement)
    and NOT against a LDAP server, and we are using a statefull backend(oraclepackages)
    which would make it
    difficult to reuse connections.
    A problem that surfaced while doing heavy loadtesting with the customconnector,
    >
    is that sometimes connections are closed and new ones made in the midst ofa transaction.
    If you imagine a scenario where a session bean creates a business entity,and
    the session bean
    calls 1 entity bean for the header and 1 entity bean for the detail, thenthe
    header and detail
    must be created in the same transaction AND with the same connection(thereis
    a parent-child relationship
    between header and detail enforced on the back end database via Primaryand Foreing
    Keys).
    We have not yet found why weblogic is closing the connection!
    A second problem that we are experincing with the custom connector, is theuse
    of CMP(container managed persistence)
    within entity beans.
    The J2EE developers state that the use of CMP decreases the develomenttime and
    thus also maintenance costs.
    We have not yet found a way to integrate a custom connector with the CMPpersistence
    scheme !
    In order to solve our loadtesting and CMP persistence problems i was askedto
    come up with a solution
    which should not use a custom connector,but use standard connection poolsfrom
    weblogic.
    To resolve the authentication problem on weblogic i could make a customrealm
    which connects to the
    backend database with the username and password, and if the connection isok ,
    i could consider this
    user as authenticated in weblogic.
    That still leaves me with the problem of auditing and pooling.
    If i were to use a standard connection pool,then all transaction made inthe oracle
    database
    would be done by a pool user or super user, a solution which will berejected
    by our local security officer,
    because you can not see which real user made a transaction in thedatabase.
    I could still use the connection pool and in the application , advise theapplication
    developers
    to set an oracle package variable with the real user, then on arrival ofthe request
    in the database,
    the logic could use this package variable to set the transaction user.
    There are still problems with this approach :
    - The administrator of the database can still not see who is connected ,he will
    only see the superuser connection.
    - This scheme can not be used when you want to use CMP persistence , sinceit
    is weblogic who will generate the code
    to access the database.
    I thought i had a solution when oracle provided us with a connection poolknown
    as OracleOCIConnectionPool
    where there is a connection made by a superuser, but where sessions aremultiplexed
    over this physical pipe with the real user.
    I can not seem to properly integrate this OCI connectionpool intoweblogic.
    When using this pool , and we are coming into a bean (session or entitybean)
    weblogic is wrapping
    this pool with it's own internal Datasource and giving me back aconnection of
    the superuser, but not one for the real user,
    thus setting me with my back to the wall again.
    I would appreciate if anyone had experienced the same problem to share apossible
    solution with us
    in order to satisfy all requirements(security,auditing,CMP).
    Many Thanks
    Blyau Gino
    [email protected]

  • Tomcat 5.0.* global JNDI database connect pooling. complex config question

    Ok. I can't get global connection pooling to work in tomcat 5.0.24. (I am running windows xp pro)
    I am using MySQL (installed on the same machine) and I have succesfully worked through the tutorial titled "MySQL DBCP Example" found at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    This example does not demonstrate global connection pooling, however. I want to share a single connection pool across all my web applications. I don't want a different connection pool for each webapp.
    So I define the connection pool JDBC resource in the conf/server.xml file under the <GlobalNamingResources> element.
    Here is the entire <GlobalNamingResources> element lifted from conf/server.xml:
    (Please overlook some of the formatting mistakes due to the <code> tag interpreting the xml as java.)
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource name="UserDatabase"
                  auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved">
        </Resource>
        <Resource name="jdbc/MySQL"
                  auth="Container"
                  type="javax.sql.DataSource"/>
        <ResourceParams name="UserDatabase">
            <parameter>
                <name>factory</name>
                <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
            </parameter>
            <parameter>
                <name>pathname</name>
                <value>conf/tomcat-users.xml</value>
            </parameter>
        </ResourceParams>
        <ResourceParams name="jdbc/MySQL">
            <parameter>
                <name>factory</name>
                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
                <name>maxActive</name>
                <value>100</value>
            </parameter>
            <parameter>
                <name>maxIdle</name>
                <value>30</value>
            </parameter>
            <parameter>
                <name>maxWait</name>
                <value>20000</value>
            </parameter>
            <parameter>
               <name>username</name>
               <value>webapp</value>
            </parameter>
            <parameter>
               <name>password</name>
               <value>******</value>
            </parameter>
            <parameter>
                <name>removeAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>removeAbandonedTimeout</name>
                <value>3000</value>
            </parameter>
            <parameter>
                <name>logAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>url</name>
                <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
            </parameter>
        </ResourceParams>
      </GlobalNamingResources>I am still trying to get the DBTest example (described in the link to the tomcat 5 docs above) to work, only now I want it to work using a global connection pool. So here is the contents of webapps/DBTest/WEB-INF/web.xml: (again, please overlook formatting difficulties :)
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
      <description>MySQL Test App</description>
      <resource-ref>
          <description>DB Connection</description>
          <res-ref-name>jdbc/MySQL</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
      </resource-ref>
    </web-app>The last thing I need to do, I think, is to include a <resourceLink> element in the context.xml file for this webapp. Now in tomcat 5.0.* it is not recommended that the <context> element appear in the conf/server.xml file. Instead, as I understand it, it should appear in either of the two following places (for a webapp called DBTest):
    $CATALINA_HOME/conf/[engine_name]/[host_name]/DBTest.xml
    $CATALINA_HOME/webapps/DBTest/META-INF/context.xmlSince I would eventually like to package each webapp in its own war file, I prefer the second option above. This will enable me to place the context.xml file within the .war file. Currently, however, I am not using .war files.
    For the DBTest webapp I have the following <context> element in webapps/DBTest/META-INF/context.xml:
    <context path="/DBTest" docBase="/DBTest" debug="1">
        <ResourceLink global="jdbc/MySQL" name="jdbc/MySQL" type="javax.sql.DataSource" />
    </context>Now, when I point my browser to http://localhost:8080/DBTest/test.jsp I get the following message:
    javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver"
    For those who are interested, here is test.jsp:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <sql:query var="rs" dataSource="jdbc/MySQL">
    select id, foo, bar from javatest.testdata
    </sql:query>
    <html>
      <head>
        <title>DB Test</title>
      </head>
      <body>
      <h2>Results</h2>
    <c:forEach var="row" items="${rs.rows}">
        Foo ${row.foo}<br/>
        Bar ${row.bar}<br/>
    </c:forEach>
      </body>
    </html>Now I know that this is a very long and detailed question and that it is unlikely that anyone is even going to read down this far, let alone take the time to study all that XML, but if anyone is able to tell me why this setup does not allow global connection pooling, I will be pretty *@&$**% impressed. I only wish I had duke dollars to give.
    Jon

    Okay, I went back and double checked that I can get the DBTest example working. It is described here: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    I was not able to get it working exactly according to the tutorial, though. I was required to put the <context> element not in the conf/server.xml but in conf/Catalina/localhost/DBTest.xml. Then, with the DBTest/WEB-INF/web.xml as above, I was able to get the DBTest example working. The output of test.jsp (described above also) is the following:
    Results
    Foo hello
    Bar 12345I would like to be able to put the <context> element in webapps/DBTest/META-INF/context.xml (as I think should be allowed) because then I would be able to include it in a war file that encompassed the entire web application. If I am forced to put the <context> element in a subdirectory of the conf directory, then I cannot include it in a war file and I will be unable to just drop my war files in the webapps directory and go. Instead I will have to drop my war files in the webapps directory, then go and fiddle around with the xml files in conf/Catalina/localhost/
    But if I move the <context> element into webapps/DBTest/META-INF/context.xml then the example stops working. When I put it back in conf/Catalina/localhost/DBTest.xml everything is fine again.
    Ok, no big deal. I guess my war file deployment will just have to be a little more complicated.
    But what if I want the resource to be global??? If I remove the <Resource> and <ResourceParams> elements from the webapp-specific <context> element and put them in the <GlobalNamingResource> element in the conf/server.xml file I should have a global resource, right? I did this, then added a resource link to the <context> element (see above), however, the example stops working. I have tried both with and without the <resource-ref> element in web.xml.
    Can some remarkably intelligent and knowledgeable person please explain to me how global resources work in tomcat 5.0, especially global JDBC connection pooling.
    Thanks,
    Jon

  • Mvc - connection pool - jstl - oh my!

    I am trying to understand how to use the mvc model to break my existing jsp's up. I finally got my connection pool working yesterday(yay!) so now I want to get everything organized into servlets. My understanding of servlets sucks - and I have not written one yet. Researching it on the net hasnt helped much - a bit overwhelming..
    Please tell me if my logic is on track or not - keeping in mind the mvc model - keeping in mind I dont know how to write a servlet : )
    DATABASE package;
    public static dbpool getConnection() {
         // write JNDI information
    public static void dbpoolClose(Connection connDB) {
         // close connection
    }Then in a servlet I would try to write something like this...
    MyBean {
    // call the connection method
    - do crud operations
    - use getters and setters
    - close statements that I have open
    // call the close connection method
    }Then in my JSP( I have JSTL working YAY!!) I wil call the bean/getters/setters and use JSTL to manipulate and present the data? Is this close to being in the MVC model?
    I havent found an example using the mvc using a connection pool, database operations and a jsp - that I have been able to understand.. so If I am waay off.. sorry.

    Basically, use the servlet to tell other classes what to do (these can be other servlets or whatever).
    Those classes prepare the data you want to have the JSPs show and process the data returned from the JSPs.
    The JSP does nothing except display data presented to it by the servlet (and may have URLs or forms to provide input to servlets.
    At its simplest, there's no controller at all (so no C). A JSP calls a servlet which processes the data sent to it and prepares new data for another (or the same) JSP to which it forwards the request when done.
    That data can be stored in the Http session or (sometimes) better in the request.
    More usually, a controller will receive all requests from and determine to what servlet to send them.
    The servlet then either determines on its own to which JSP to send the results or gives those results back to the controller which will do that for them and forward to the proper JSP.
    If needed you can thus chain requests so that a request goes to a servlet, from there to another servlet and then to a JSP (for example), each time via the controller.
    This can be handy to break up complex processing in small steps where those small steps could also occur separate.

  • Connection Pool Failure: "No suitable driver"

    Hi,
    Upon server startup, I get the following result:
    <Nov 7, 2001 4:18:32 PM CST> <Error> <JDBC> <Cannot startup connection pool "ora
    cleTrufflePool" No suitable driver>
    I assumed it was a path problem, but in the startWebLogic.cmd script I've set the PATH and CLASSPATH variables to the same as in a separate command window that can successfully dbping the Oracle db.
    One thing I completely don't understand is what the URL value should be for the pool, and I can't see a pattern in the examples and docs I've found on this. Here are my pool settings, at any rate:
    Name: oracleTrufflePool
    URL: myOracleServerName
    Driver Classname: weblogic.jdbc.oci.Driver
    Properties:
    user=user
    password=password
    server=myOracleServerName
    ACLName: user
    Password: password
    As you can see, I also don't understand whether the Oracle user name and password must be duplicated in the Properties section, or should they really only be listed in the ACLName and Password fields (in the Server Console UI)?
    TIA,
    Steve

    Hi. The issue is that the URL you give is not the URL the driver (weblogic.jdbc.oci.Driver)
    wants. The URL should be "jdbc:webLogic:oci". The properties user, password and server
    will be passed to the driver for conenction attempts. The ACL is for who gets to use the
    pool, and the other password entry is only if you need the DBMS password to be encrypted
    in the XML. If so, set that password value, and don't have it in the driver properties.
    Joe
    Steve Clark wrote:
    >
    Hi,
    Upon server startup, I get the following result:
    <Nov 7, 2001 4:18:32 PM CST> <Error> <JDBC> <Cannot startup connection pool "ora
    cleTrufflePool" No suitable driver>
    I assumed it was a path problem, but in the startWebLogic.cmd script I've set the PATH and CLASSPATH variables to the same as in a separate command window that can successfully dbping the Oracle db.
    One thing I completely don't understand is what the URL value should be for the pool, and I can't see a pattern in the examples and docs I've found on this. Here are my pool settings, at any rate:
    Name: oracleTrufflePool
    URL: myOracleServerName
    Driver Classname: weblogic.jdbc.oci.Driver
    Properties:
    user=user
    password=password
    server=myOracleServerName
    ACLName: user
    Password: password
    As you can see, I also don't understand whether the Oracle user name and password must be duplicated in the Properties section, or should they really only be listed in the ACLName and Password fields (in the Server Console UI)?
    TIA,
    Steve

Maybe you are looking for

  • HT1218 Problem with Airport Express in Windows 7

    I am using my one year old Airport Express with my Dell LapTop, now it is on fixed amber light. I did reset it many times but no luck. I cannot see it on my airport utility. I uninstall and downloaded older versions of airport utility but no success.

  • Policy Agent for Domino 6.5.1

    I am trying to find out if the 2.2 Policy Agent for Domino (6.5.4) is supported for Domino 6.5.1. Thanks in advance, Eric

  • Photo sync when Photoshop Elements also on PC

    Hi, I've a really annoying problem with iTunes and Photoshop Elements when syncing photos to my IPod. I use Elements on the PC to manipulate photos, not specifically to organise them as I already have a folder structure that suits my needs. I also us

  • HTTP Request/Response in ABAP

    Hello Experts I have a simple requirement, where I want to access a web url from my ABAP program and get the response from url in my program. I have never handled such a requirement. Kindly suggest the solution. Thanks and best regards, Anand.

  • Cannot purchase from app

    HI I have 10 dollars of credits in my apple ID but when I tried to purchase something from the app clash of clans it just shows please contact iTunes Store for support, may I know why does this happen and what do i need to do? Thank you.