Servlet for Connection Pooling in NetBeans & builtin Tomcat

A

Asad

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!
 
Joined
Oct 19, 2006
Messages
1
Reaction score
0
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 :)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top