Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts

    connection pool, tomcat, mysql

    1. searching found nothing on this forum
    2. does onyone has his/her own instruction how hi/she did it (tomcat/mysql)
    3 after toon of googling found nothinhg that would support my idea:
    3.1 call servlet - get connection from pool of connections
    3.2 call servlet - return connection to pool of connections
    4. found no cases on google where connection would be pulled out od pool
    from java class

    Any advice velcome.

  • #2
    Regular Coder brad211987's Avatar
    Join Date
    Sep 2005
    Location
    Ohio
    Posts
    631
    Thanks
    10
    Thanked 50 Times in 50 Posts
    Tomcat has built in support for connection pooling using JNDI, but I was never able to get it working.

    There is all kinds of information about managing a connection pool that comes up from a Google Search, here is first result:

    http://java.sun.com/developer/online...k/conpool.html

    All you would need to do in your case is use the servlets doGet or doPost method and use a request parameter to specify rather you are asking for or returning a connection to/from the pool. Initialize the pool when the servlet initializes and control it all through the servlet requests.

  • #3
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts
    ok, I found some usable source:
    http://www.kgo.de/Pool.html
    and managed to get it working
    What it basicaly does is open connection on request, put it in pool and let it live for 5 minutes,mean while it is usable for other requests, untested doh.

    sub question;

    can it be somehoew done this:

    Code:
    ResultSet rs = stmt.executeQuery(query);
    response.setContentType(recordset);
    ....
    instead of

    response.setContentType("Text/html");

    ?
    Last edited by BubikolRamios; 07-10-2008 at 05:25 AM.

  • #4
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,994
    Thanks
    120
    Thanked 76 Times in 76 Posts
    ok, implemented: http://proxool.sourceforge.net/

    and it looks that it works fine, but take a look at this, is this ok ?

    look at getconnection, setdataset, executesql

    Edit: hmm, seems this is summary (Self time)


    Last edited by BubikolRamios; 07-13-2008 at 10:54 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •