Servlet for Connection Pooling in NetBeans & builtin Tomcat

Discussion in 'Java' started by Asad, Dec 24, 2004.

  1. Asad

    Asad Guest

    Hi,

    I installed Netbeans 4.0 a few days ago and so far pretty impressed by
    it. Previously I was using Tomat 4.0, and I like the idea of embedded
    Tomcat 5 that can be managed via the IDE. To get things started, I
    followed the article here:

    http://www.netbeans.org/kb/using-netbeans/40/dbconn.html

    to get a connection pool configured in the included Tomcat 5 web
    server. Everything in the example works great. However, I don't want
    to use the taglibs, and would rather write servlets and beans to do
    the task. I tried following the example listed here:
    http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    however that doesn't work for me (I get foo -1 or something; basically
    its not working).

    So I was wondering if someone could kindly provide me a simple servlet
    that works in the Netbeans IDE so I can simply extend on the tutorial
    here: http://www.netbeans.org/kb/using-netbeans/40/dbconn.html and and
    draw connection from the tomcat 5 connection pool having configured
    everything perfectly in this tutorial. Basically do the same thing as:

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>

    <sql:query var="queryresults" dataSource="jdbc/poolDB">
    SELECT * FROM t_emp ORDER BY upper(f_name)
    </sql:query>

    <table border=1>
    <tr>
    <th>First</th><th>Last</th>
    </tr>
    <c:forEach var="row" items="${queryresults.rows}">
    <tr>
    <td><c:eek:ut value="${row.f_name}" /></td>
    <td><c:eek:ut value="${row.l_name}" /></td>
    </tr>
    </c:forEach>
    </table>

    but in a servlet rather than using the tag library.

    Very much appreciated!
    Asad, Dec 24, 2004
    #1
    1. Advertising

  2. Asad

    jmens

    Joined:
    Oct 19, 2006
    Messages:
    1
    directions for netbeans 5 jdbc connection pooling..

    If it helps I have recently put together a how-to on getting netbeans 5 to use a connection pool to postgresql databases. you can view it at

    http://www.mitarisk.com/blog/


    It should work for any database backend as far as I can tell.

    Hope it helps someone :)
    jmens, Oct 19, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Baba
    Replies:
    3
    Views:
    4,469
  2. circuit_breaker
    Replies:
    2
    Views:
    1,984
    Jack Jia
    Apr 4, 2004
  3. Chandrakanth

    Tomcat Connection pooling with oracle

    Chandrakanth, Jun 7, 2004, in forum: Java
    Replies:
    0
    Views:
    453
    Chandrakanth
    Jun 7, 2004
  4. bigbinc
    Replies:
    0
    Views:
    528
    bigbinc
    Jul 23, 2004
  5. bdb112
    Replies:
    2
    Views:
    289
    Chris Torek
    Jul 2, 2011
Loading...

Share This Page