Subject Re: [Firebird-Java] Connection Pooling Jaybird
Author Rick Fincher
Hi Michael,

(Sorry all, this is more Tomcat than JayBird but a lot of folks have
trouble with this, so maybe it is useful)

Tomcat changed a lot from 4.x to 5.0.x to 5.5

I never used 5.0.x I went straight from 4.1.24 to 5.5.4 but the
following should work for 5.0.x too.

A big change was in how contexts were set up for data sources. In 4.x
you put all of the DataSource and context info in the server.xml file.
This created problems because you had to restart the server each time
you added a new web app that used a new data source, a big no-no for
production systems.

So in the later versions of Tomcat they added the ability for Tomcat to
configure a web app context for data sources at deployment time.

With Tomcat 5 and up, pooled connections with Commons DBCP are the
default, so no longer have to mess with pooling factories, etc. You can
go into the Tomcat Administration web app and set up the data sources.
It is usually at There is a link to it
on the Tomcat splash page.

This is NOT the Manager page. The Administrator app essentially writes
the xml in the active version of "server.xml" for you and updates the
running server. You can still hard code the DataSources in server.xml
if you need to configure the more unusual parameters. Using the
Administrato tool is a good way to start, though, because it puts the
basics in the server.xml file.

When you restart Tomcat the DataSources should still be there.

Use: "SELECT CAST(1 AS INTEGER) FROM rdb$database" for the validation
query when setting up the DataSource. That is a good one for firebird.

Be sure to write down the info you create the DataSources with because
the running version of the server.xml file could (and probably will) be
lost if something happens to Tomcat.

The big change is in how you set up your web app. In 5.x you must go
into (or create) the META-INF directory in the root of your web app and
create a file called context.xml. Note: This is NOT WEB-INF.

In that file you put an entry like:

<Context docBase="db" path="/db" >
<ResourceLink name="jdbc/db" global="jdbc/db"
<ResourceLink name="jdbc/dbGraphic" global="jdbc/dbGraphic"

This links two DataSources (jdbc/db and jdbc/dbGraphic) to a web app
named "db". Change this to your web app's name. Change "jdbc/db" to
whatever you named your DataSource.

You must use the same names that the DataSource is deployed with. It is
called the JNDI Name in the administration tool.

After you deploy your web app you can go into the
/conf/Catalina/localhost directory of your Tomcat installation and you
should see a .xml file for each web app Tomcat is serving.

If you look in the file coresponding to your web app you should see
something like:

<?xml version="1.0" encoding="UTF-8"?>

This lets you know that Tomcat is linking your web app to the resources

With Tomcat 5 and up it is not recommended that you put context info in
the server.xml file.

On the main docs page click on "Tomcat Configuration" under the
"Reference" heading, then click on the "Server", "Context", and "Default
Context" entries to see more details.

Hope this helps! Since this is a little off topic you can reply
directly to me if you need further help.


Michael Koch wrote:

>I'm using the Conection Pooling Examples from the FAQ Jaybird examples
>(JayBird-2.0.1JDK_1.5) with
>Tomcat 5.0.28 and Firebird 1.0.3
>8- How do i use JayBird with Tomcat?
>The first example works fine, but in the second example,
>I get the Error Message: Could Not get data source, error:
>Name java:comp is not bound in this Context
>Can anybody help me?
>Greets miko
>Yahoo! Groups Links