Subject Re: [Firebird-Java] Need help with JCA/JDBC driver install to connect to Firebird Database - Linux
Author Catalin Florean
Hi,

To connect to your Firebired from Tomcat you will need to:

1. create a context xml file in the $TOMCAT_HOME/conf/Catalina/localhost
directory

<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource
auth="Container"
description="DB Connection"
name="jdbc/YourDatasourceName"
type="javax.sql.DataSource"
password="YourPassword"
driverClassName="org.firebirdsql.jdbc.FBDriver"
maxIdle="50"
maxWait="50000"
validationQuery=""
username="YourUserName"
url="jdbc:firebirdsql:local:PathToYourDatabaseFile"
maxActive="250"/>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

You can also use Tomcat's admin app to create DataSource.

2. the web.xml file in you application context
($TOMCAT_HOME/webapps/YourContext/WEB-INF) will be something like this:

web.xml file content:

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
<display-name>YourDisplayName</display-name>
<description>YourDescription</description>

<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/YourDatasourceName</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

<servlet>
<servlet-name>Example1</servlet-name>
<servlet-class>Example1</servlet-class>
</servlet>
...
...
...
<servlet-mapping>
<servlet-name>Example1</servlet-name>
<url-pattern>/Example1</url-pattern>
</servlet-mapping>
</web-app>

3. copy the Firebird JDBC driver to $TOMCAT_HOME/common/lib

4. test your connction with a simple servlet, something like this:

try {
Context ctx = new InitialContext();
ds =
(DataSource)ctx.lookup("java:comp/env/jdbc/YourDatasourceName");
conn = ds.getConnection();
conn.setAutoCommit(false);
}
catch (Exception e){
}

5. You should use Jaybird 1.5.6 JDBC driver.

Good luck.

Catalin Florean


On 5/2/06, Bijilal Poikayil <bijilal@...> wrote:
>
> Hi
>
> I am new to Firebird and I would like to make the jdbc connection
> work with this database. I have a linux box (Redhat).
>
> S/w version that I have and status of each.
>
> 1. Tomcat Version 5.5.9 => This is installed and fully operational
> 2. Firebird - FirebirdSS-1.5.3.4870.i686.rpm ==> This is installed
> and fully operational.
> 3. I kind of identified the jdbc s/w I would need to connect here
> will be - JayBird-2.0.1JDK_1.5.zip ( I am not really sure if this
> will work with my version of Firebird). So it will be great if any
> one suggest the right vesrion of Jbird I should use.
> 4. What are the steps to setup the JDBC connection. All I know at
> this point is that to copy the jar file below to
> $CATALINA_HOME/common/lib/
>
> unzip -l JayBird-2.0.1JDK_1.5.zip jaybird-full-2.0.1.jar
> Archive: JayBird-2.0.1JDK_1.5.zip
> Length Date Time Name
> -------- ---- ---- ----
> 627472 12-04-05 20:38 jaybird-full-2.0.1.jar
> -------- -------
> 627472 1 file
>
> I have no clue if it works after that, so I am looking forward to
> hear from any one who has done this before so that I can try to set
> it up.
>
> Thanks for your help and time.
>
> Biji
>
>
>
>
>
>
>
>
>
> SPONSORED LINKS
> Basic programming language<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=bnac3LCZpttb3c9FvbVU-A> Computer
> programming languages<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=1Czd2hKCO9_u4KVZQperFQ> Programming
> languages<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=TyHGCjod4YOKITrSq1xccQ> Java
> programming language<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&c=4&s=126&.sig=PZAexF9LyXpKb3HDJSlB1g>
> ------------------------------
> YAHOO! GROUPS LINKS
>
>
> - Visit your group "Firebird-Java<http://groups.yahoo.com/group/Firebird-Java>"
> on the web.
>
> - To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com<Firebird-Java-unsubscribe@yahoogroups.com?subject=Unsubscribe>
>
> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------
>


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