Subject | Re: Configuring Tomcat JNDI and Firebird |
---|---|
Author | grndeveloper |
Post date | 2006-10-16T15:47:14Z |
Hello Rick,
I think I have implemented your solution, but I get the same mistake.
I have created a Datasource from Tomcat Administration, and I have
not modified it manually. Now it looks like:
<Resource
name="sg2_bbdd"
type="javax.sql.DataSource"
password="masterkey"
driverClassName="org.firebirdsql.jdbc.FBDriver"
maxIdle="2"
maxWait="5000"
validationQuery="select cast(1 as integer) from rdb$database"
username="sysdba"
url="jdbc:firebirdsql:192.168.2.2/3050:home/sg2/sg2JAVA.fdb"
maxActive="5"/>
I have created a new file /META-INF/context.xml which generates me the
file /conf/Catalina/localhost/jaume1.xml , which looks like:
<Context docBase="jaume1" path="/jaume1" >
<ResourceLink name="link_to_sg2_bbdd"
global="sg2_bbdd" type="javax.sql.DataSource"/>
</Context>
Besides that I also have this portion of code in the web.xml file, but
I guess it's not necessary.
<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>
Is there anything else, that I am missing?
Thanks in advance.
I think I have implemented your solution, but I get the same mistake.
I have created a Datasource from Tomcat Administration, and I have
not modified it manually. Now it looks like:
<Resource
name="sg2_bbdd"
type="javax.sql.DataSource"
password="masterkey"
driverClassName="org.firebirdsql.jdbc.FBDriver"
maxIdle="2"
maxWait="5000"
validationQuery="select cast(1 as integer) from rdb$database"
username="sysdba"
url="jdbc:firebirdsql:192.168.2.2/3050:home/sg2/sg2JAVA.fdb"
maxActive="5"/>
I have created a new file /META-INF/context.xml which generates me the
file /conf/Catalina/localhost/jaume1.xml , which looks like:
<Context docBase="jaume1" path="/jaume1" >
<ResourceLink name="link_to_sg2_bbdd"
global="sg2_bbdd" type="javax.sql.DataSource"/>
</Context>
Besides that I also have this portion of code in the web.xml file, but
I guess it's not necessary.
<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>
Is there anything else, that I am missing?
Thanks in advance.
--- In Firebird-Java@yahoogroups.com, Rick Fincher <rnf@...> wrote:
>
> 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]
>