Subject Re: [Firebird-Java] Configuring Tomcat JNDI and Firebird
Author Rick Fincher
Hi,

With Tomcat 5.5.x you should not be modifying the server.xml file. Go
into the tomcat administrator application and create your data sources
there. The administrator app has a link on the Tomcat splash page.

In the <CATALINA_HOME>/conf/Catalina/localhost directory you should see
an XML file with the name of your web app. If you do not, your context
is not set up properly.

This file gets generated by Tomcat from your context.xml file that is
located in the META-INF folder of your web application.

It should look something like this:

<Context docBase="webAppName" path="/webAppName" >
<ResourceLink name="jdbc/yourDataSourceName"
global="jdbc/yourDataSourceName" type="javax.sql.DataSource"/>
</Context>

There should be a resource link for each data source you want to use.

By doing things this way, Tomcat can launch your web apps and add or
drop data sources without restarting Tomcat and disrupting everybody
elses web apps.

Put your server.xml file back to the default and restart Tomcat. Then
go in the administrator to create your Data Sources. A good validation
query for Firebird is: SELECT CAST(1 AS INTEGER) FROM rdb$database. It
should always work.

Check to be sure your context.xml file for your web app got created as
described above.

Your username will have to be listed as an administrator in whatever
login database scheme you are using (tomcat-users.xml, etc.) for you to
have access to the administrator application.

Hope this helps!

Rick

grndeveloper wrote:

> We are on Tomcat version 5.5.9 and we are using Jaybird 2.1.0 with IBATIS.
> We have IBATIS working in a simple DATASOURCE configuration, and now
> we are trying to configure our application to use JNDI and connection
> pooling.
>
>
> We have made this modifications in the following files:
>
> >>>>server.xml >>>>>>>>
> ...
> <GlobalNamingResources>
> ...
> <Resource name="sg2_bbdd" auth="Container"
> type="javax.sql.DataSource"/>
> <ResourceParams name="sg2_bbdd">
> <parameter>
> <name>validationQuery</name>
> <value>select x_idio.idio_codi from x_idio</value>
> </parameter>
> <parameter>
> <name>maxWait</name>
> <value>5000</value>
> </parameter>
> <parameter>
> <name>maxActive</name>
> <value>10</value>
> </parameter>
> <parameter>
> <name>username</name>
> <value>sysdba</value>
> </parameter>
> <parameter>
> <name>password</name>
> <value>masterkey</value>
> </parameter>
> <parameter>
> <parameter>
> <name>url</name>
>
> <value>jdbc:firebirdsql:192.168.2.2/3050:home/sg2/sg2JAVA.fdb</value>
> </parameter>
> <parameter>
> <name>driverClassName</name>
> <value>org.firebirdsql.jdbc.FBDriver</value>
> </parameter>
> <parameter>
> <name>maxIdle</name>
> <value>5</value>
> </parameter>
> </ResourceParams>
> </GlobalNamingResources>
> ...
> <Host
> appBase="webapps"
> name="localhost">
> <DefaultContext>
> <ResourceLink
> global="sg2_bbdd"
> name="jdbc/link_to_sg2_bbdd"
> type="javax.sql.DataSource"/>
> </DefaultContext>
> </Host>
>
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> >>>web.xml >>>>>>>>
> .....
> <resource-ref>
> <res-ref-name>jdbc/link_to_sg2_bbdd</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> <res-sharing-scope>Shareable</res-sharing-scope>
> </resource-ref>
> .....
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> >>>>sql-map-config.xml (Ibatis configuration
> file)>>>>>>>>>>>>>>>>>>>>>>>>
>
> ....
> <transactionManager type="JDBC">
> <dataSource type="JNDI">
> <property value="java:comp/env/jdbc/link_to_sg2_bbdd"
> name="DataSource"/>
> </dataSource>
> </transactionManager>
> ....
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>
> We also have put the jaybird-full-2.1.0.jar into the
> [CATALINA_HOME]/common/lib directory. In our application there is no
> reference to jaybird-full-2.1.0.jar
>
> With all this changes all we get from Tomcat logs is the following
> error message:
> org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC
> driver of class '' for connect URL 'null'
> ...
> Caused by: java.sql.SQLException: No suitable driver"
> ...
>
> I think the problem we have has nothing to do with IBATIS, it is just
> we are doing something wrong with the driver or the tomcat configuration.
> Does anyone could give us some help?
>
> Thanks in advance.
>
> _
>
>




[Non-text portions of this message have been removed]