Subject Re: [Firebird-Java] Setting up Firebird Pool inside Tomcat 5.5
Author Federico Tello Gentile
I'm going to answer my own question.

Maybe this can go to the firebird wiki since what's there is outdated
and does not work with Tomcat 5.5.

This sets up a pool managed by tomcat in some standard way I'm not too
familiar with yet, but you can forget about everything else.

Place firebirdsql-full.jar in ${CATALINA_HOME}/common/lib

In the application's context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/PooledWebapp" reloadable="false">
<Resource auth="Container"
driverClassName="org.firebirdsql.jdbc.FBDriver"
maxActive="100" maxIdle="30" maxWait="100"
name="jdbc/dbTest"
password="masterkey"
type="javax.sql.DataSource"

url="jdbc:firebirdsql://localhost:3050/c:\fede\test.fdb?lc_ctype=UNICODE_FSS"
username="SYSDBA"/>
</Context>

In the application's web.xml
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/dbTest</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

To do sql inside an index.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/dbTest">
select id, nombre, telefono from persona
</sql:query>

<c:forEach var="row" items="${rs.rows}">
Id ${row.id}<br/>
Nombre ${row.nombre}<br/>
Tel: ${row.telefono}<br/>
</c:forEach>

To get a connection inside a java class
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/dbTest");
Connection conn = ds.getConnection();