How can i improve database connectivity with connection pool

Hi,
I used to create a connection to DB per session since the application is pretty small. Now i want to improve the db connectrion with connection pool. However, i am still confused since the book i read says that i have to change something in server.xml in the tomcat server while other people in this forum actually implement a connection pool class. Isnt it has been built into the servlet container? if yes, how can i use it? I suppose i only have to open the connection and the connection pool will reclaim the resource when the session is terminated in the same way the gabage collector reclaim resource when no reference is associated to object, am i correct?
Thai

the documentation for Tomcat 5 DB pooling can be found at:
http://jakarta.apache.org/tomcat/tom...les-howto.html
Here are the Tomcat 4 docs:
http://jakarta.apache.org/tomcat/tom...les-howto.html
The administration console can be found at (under default install):
http:localhost:8080/admin
But, you have to set up a user and password in your
<tomcat-install>/conf/tomcat-users.xml file.
You need to add an "admin" role and a user that will be assigned this
role like this (obviously you won't be using "tomcat" as your password):
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="admin"/>
<user username="tomcat" password="tomcat" roles="admin"/>
</tomcat-users>
So, I can log in as Tomcat and have admin privs.
Tomcat 5
http://jakarta.apache.org/tomcat/tom...ger-howto.html
Tomcat 4
http://jakarta.apache.org/tomcat/tom...ion%20A ccess
i'm sure this helps u

Similar Messages

  • How can I kill database connections

    I would like to know how can I kill all the database connexion at the end of an application. I'm using acces
    thx

    use con.close() in a finally statement after your catch blocks that tests whether con equals null. If con != null, then con.close();
    example:
    finally {
              //close the database connection.
              try {
                      if (con != null) con.close();
              catch (SQLException e) {
    }

  • How can I use the Connection Pool with DB2

    Hi All,
    I am facing the problem with the usage for the Connection Pool.
    I want to use DB2 via JNDI lookup.
    But when starting the Weblogic server, Error occured with the following message.
    <Error> <JDBC> <Cannot startup connection pool "MyJDBCPool" Cannot load driver class : com.ibm.db2.jdbc.app.DB2Driver>
    DB2 and Weblogic are on the same machine.
    In case of the use of remote DB2 database, I also encountered the same error.
    Configurations are as follows.
    <JDBCConnectionPool DriverName="com.ibm.db2.jdbc.app.DB2Driver"
    MaxCapacity="10" Name="MyJDBCPool"
    Password="{3DES}gCGsOfD9M6iwOtgL2v/NpA==" Targets="myserver"
    TestConnectionsOnReserve="false" TestTableName="test" URL="jdbc:db2://localhost:6789/yongjoo"/>
    <SNMPAgent Name="mydomain"/>
    <JDBCDataSource JNDIName="acsdb" Name="acsdb" PoolName="MyJDBCPool" Targets="myserver"/>
    Could you please give some information about this problem? I will appreciate your kindness.

    Hi Joe,
    Thanks your help.
    Perhaps It's my fault for Weblogic console's setting.
    After I reset the target server in console, Error message disappeared.
    But, when I call the TestCode, I encountered another error message. The error
    is NameNotFoundException.
    When lookingup the JNDI name, NameNotFoundException errer occured. I tried to
    change my setting and JNDI name, but the results are the same.
    Would you please give me some information about this one more time? I will be
    appreciated for your help.
    Follows are Config.xml
    <JDBCConnectionPool DriverName="com.ibm.db2.jdbc.app.DB2Driver" MaxCapacity="10"
    Name="MyJDBCPool" Password="{3DES}gCGsOfD9M6iwOtgL2v/NpA==" Targets="myserver"
    TestConnectionsOnReserve="false" TestTableName="test"
    URL="jdbc:db2://localhost:6789/yongjoo"/> <SNMPAgent Name="mydomain"/>
    <JDBCDataSource JNDIName="acsdb" Name="acsdb" PoolName="MyJDBCPool"
    Targets="myserver"/>
    and follows are TestCode,
    url = "t3://localhost:7001"; //default URL
    datasource = "jdbc/acsdb";
    Context ctx = null;
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, url);
    try{
    ctx = new InitialContext(p);
    System.err.println("initialContext(p)"+ctx); <-- success
    ds = (DataSource)ctx.lookup("java:comp/env/jdbc/acsdb");
    }catch(NameNotFoundException ne){
    throw new ConnectionException(); .
    }catch(NamingException ne){
    throw new ConnectionException();

  • How can i include database connection in an EP development

    Does any body knows what are the steps to include database connection in an EP development in NWDS?

    Hi Jose.
    http://help.sap.com/saphelp_nw04/helpdata/en/30/a0f17aacb34b108b39a96acc33da3f/frameset.htm
    or
    http://help.sap.com/saphelp_nw04/helpdata/en/fe/9e362f3d954e8e8555007d8030df63/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
    Regards, Karsten

  • How can I implement the connection pool in my java stored procedure

    my java stored procedures (in database 'B') have to connect to another oracle database ,let's say 'A'. And how can I implement the behavior like the so-called connection pool in my java stored procedure in 'B', as below.
    1. database B, has 2 java stored procedures sp1 and sp2
    2. both sp1 and sp2 connects to databse 'A'
    whatever I call the sp1 and sp2 and the database 'A' always only one connected session from sp1 and sp2 in database 'B'.
    THANKS A LOTS...

    my problem is I have a lots of java stored procedures need to cnnect to the remote oracle db, and I hope the remote db can only have a connected session from my java stored procedures in my local db. I try as below
    class sp{
    static Connection conn=null; //the remote db connection,
    public static void sp1(){...}//procedure 1, using conn
    public static void sp2(){...}//procedure 2, using conn,too
    I can 'see' the 'conn' variable if I invoke the sp1() and sp2() from the same client application(maybe sqlplus). But if I invoke the sp1() from client 'A' and invoke sp2() from client 'B' then the sp1() and sp2() can not see the 'conn' variable for each other. I think it's because the two clients cause oracle to create two instances of the class 'sp' and the sp1() and sp2() located in different instance seperately. Thus the sp1() and sp2() can not see 'conn' for each other. They can only see its own 'conn'.
    To connect to the remote db from the java stored procedure is easy but is it possible to connect to the remote db via database link from the java stored procedure at my local db ? If so, then I also archive my goal .
    BTW , thanks a lots...
    andrew :-)

  • How can I switch the connection pool dynamically during on load happens

    HI,
    I have two data bases which holds same data. i.e Prod_db, Prod_db1,
    I want to switch the connection pool dynamically during load happens
    Ex: During load happens i want to hit prod_db1, after load completes i want to hit prod_db. How to achieve this.

    create dynamic repository variable for DSN using init block so that value is changes based on your timings and use this in connection pool.
    If you use same user and passwords for both the databases that would be easy or else need to follow the same for uid and pwd.
    That should work, if not update.
    If helps pls mark correct/helpful

  • How can i use the connection pool in JDBC2.0

    Thanks

    Hi,
    You can use DbConnection broker which directly returns connection to DB
    Try http://www.javaexchange.com/
    In that you can specify max and min pool connection pool size
    see example below:
    DbConnectionBroker dbBroker = new DbConnectionBroker(strDBDriver, strDBURL,strDBUser, strDBPassword, iMinPoolSize,     iMaxPoolSize, strLogFile, dblTimeInMillisBetResets);

  • How can i create Database Connection in Swing Applet?

    A DESCRIPTION OF THE PROBLEM :
    I am unable to connect to oracle database using thin driver
    in Swing Applet.
    ENVIRONMENT:
    java version "1.3.1_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
    Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)
    FULL OPERATING SYSTEM VERSION : NT 4.0
    Java file:-
    import javax.swing.*;
    import java.awt.event.*;
    import java.sql.*;
    import java.awt.*;
    public class SwingApplet extends JApplet
       public void init(){
       public void start(){
        JTextField txf=new JTextField();
        JButton btn=new JButton("Click Me");
        btn.addActionListener(new ActionListener(){
            public void actionPerformed(ActionEvent ae){
            try{
            DriverManager.registerDriver(new
    oracle.jdbc.driver.OracleDriver());
            Connection con=DriverManager.getConnection
    ("jdbc:oracle:thin:@orasrv:1521:oracledb","hrisadmin","hrisadmin");
            Statement st=con.createStatement();
            ResultSet rs=st.executeQuery("select * from applicant");
            }catch(Exception e){JOptionPane.showMessageDialog
    (null,e.toString());}
            JOptionPane.showMessageDialog(null,"Hai Swing is cool");
        getContentPane().add(txf,BorderLayout.NORTH);
        getContentPane().add(btn,BorderLayout.CENTER);
       public void stop(){
       public void destroy(){
    html file:-
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
       width="120" height="160" align="middle"
       codebase="http://java.sun.com/products/plugin/1.1.2/
            jinstall-12-win32.cab#Version=1,2,0,0">
       <PARAM NAME="code" VALUE="SwingApplet.class">
       <PARAM NAME="codebase" VALUE=".">
       <PARAM NAME="archive" VALUE="classes111.zip">
    </OBJECT>ERROR MESSAGES/STACK TRACES THAT OCCUR :
    java.security.AccessControlException:access denied(java.net.SocketPermission or
    asrv resolve)

    if the applet runs locally, and you want to connect to your DB locally with the applet, it won't work (except if you adjust the security settings of your browser, maybe). That's because applets don't have access to the computer they're running on (except some information), since that would mean that any applet could just access your computer, so, it's not possible for security purposes.
    On the other hand, they don't have to right to connect to anything, except the server they're downloaded from ( so the webserver's ip).
    But I'm not sure about connecting to a DB through JDBC that way.
    Tom

  • How can we improve query performance with out indexes?

    Hello Experts,
    I have a problem with table(calc) which contain 3 crore records and table doesn't have index, on that table one of the view(View_A) created.
    When i use the view in  below query SELECT count(*)
    FROM
      Table A INNER JOIN Table B ON (A.a=B.b)
       LEFT OUTER JOIN View_A ON ( Table A.a=View_A.a)
       LEFT OUTER JOIN View_B ON (Table A.a=View_B.a)
    In above query View_A is causing the problem, view_A is created on Calc table. One more thing when i execute select statement on the view it was running fine.
    With out View_A query fetching data fine. Update stats of the table also fine. When i run cost plan for scanning only cost % is 90.
    Can any help me please?.
    Thank you all.
    Regards,
    Jason.

    Jason,
    Not sure what you are trying to do. But outer joins are bad for performance. So try to avoid them.
    You also say that you have a view on a calc table. What are you calculating? Are you using user defined functions maybe?
    Regards,
    Nico

  • I have Airport Extreme as the base unit and an Express unit in a room separated by a brick wall to improve signal. Express shows a green light indicating signal but my iPad does not perform well. How can I improve other than hardwire ethernet connection?

    I have Airport Extreme as the base unit and an Express unit in a room separated by a brick wall to improve signal. Express shows a green light indicating signal but my iPad does not perform well. How can I improve other than hardwire ethernet connection?

    Other suggestions, and more info about the nature of the problem, may be in this Apple tech note.
    http://support.apple.com/kb/HT1365
    For example, you might find that the brick wall is not the only problem. There may be other devices pumping out enough wireless interference to be making things even worse.
    I agree with Bob Timmons that Ethernet is best and most reliable. And that powerline (which I use) is easier and potentially faster than wireless...but only if your power lines do not have electrical devices plugged in which produce electrical noise on the line. Powerline will be slower than Gigabit Ethernet.
    Ethernet cable is the only way to ensure that the signal goes directly there in a shielded way for a clear fast signal. Wireless and powerline are much slower because of all the other things the signal has to fight past to get to the other device.

  • HT1386 When I connect my iPod Touch to a new laptop (Macbook Air) the "Info" tab won't appear and therefore I cannot sync it with my new iTunes. How can I sync this iPod with the iTunes on my new laptop?

    When I connect my iPod Touch to a new laptop (Macbook Air) the "Info" tab won't appear and therefore I cannot sync it with my new iTunes. How can I sync this iPod with the iTunes on my new laptop?

    There is no Info tab in Mavericks
    if you use OS X v.10.8.5 or earlier. If you use OS X Mavericks v.10.9 or later, your contacts, calendars, and other info are updated on your computers and iOS devices via iCloud. For more information, see iCloud Help at icloud.com.
    iTunes 11 for Mac: Sync contacts, calendars, and other info with iPod, iPhone, or iPad

  • I have a mac book pro, an ipad and an iphone.  i have an icloud account that allows my iPad and imac to sync.  but my mac book only has a connection to 'mobile me'.  how can i include my macbook with my other devices?  help!  thanks

    i have a mac book pro, an ipad and an iphone.  i have an icloud account that allows my iPad and imac to sync.  but my mac book only has a connection to 'mobile me'.  how can i include my macbook with my other devices?  help!  thanks

    You need OSX 10.7.2 or higher in order to access icloud.  The mobile me account is now defunct (it closed down more than a year ago).

  • My laptop died so I've installed itunes onto another PC and my music is all on an external hardive which is connected to the new PC. How can I sync my ipod with the new itunes and get all the music onto itunes?

    My laptop died so I've installed itunes onto another PC and my music is all on an external hardive which is connected to the new PC. How can I sync my ipod with the new itunes and get all the music onto itunes?

    You might consider itunes match for moving CDs you've copied into your itunes library if you dont have a way to use home sharing.
    iTunes match is an optional service offered by apple that costs about $25 a year.  It scans your music library and if it finds music that is already in apple's itunes catalog it'll automatically "unlock"/"store" these in the cloud for you.  Items that it does not find in the catalog it'll upload and store these in the cloud for you and you can download them on your devices.  See http://www.apple.com/itunes/itunes-match/

  • How do I improve my connectivity using the I pad with cell?

    How can I improve connectivity on my I Pad when using cell service?

    What kind of problems are you having?  The signal usually depends on the signal based on the distance from the tower and other natural things such as obstructions and things like that.  If your cell phone is going to have lousy service in an area, chances are, your iPad is going to as well as it uses the same towers

  • How can I establish bluetooth connection with my iPhone so I can share and modify my iPhone's contact list on my macbook?

    How can I establish bluetooth connection with my iPhone so I can share and modify my iPhone's contact list on my macbook?

    The Mac and iPhone sync with iTunes though the charge cable that is included with the iPhone. Through this, you can sync your calendars and contacts.
    Bluetooth is an impractical sync scheme as the time it would take to say transfer your song catalog could be longer than your phone contract. I suppose it is entirely possible to implement with hacks and jailbreaking, but I am fairly sure it is beyond the rules here to discuss such activities.
    You may wan tto ask this same question in the iPhone section of the comminitie here. There may be some workarounds for just contacts.

Maybe you are looking for