Subject | Re: [Firebird-Java] Re: Firebird in Tomcat 5.5.x |
---|---|
Author | Gonzalo Odiard |
Post date | 2005-02-18T17:41:39Z |
Thanks, Rick.
The problem was with the sintax of the url, because it is diferent to
the url in JBoss.
Thank you, for the detailed response.
Gonzalo Odiard
rfincher2000 wrote:
The problem was with the sintax of the url, because it is diferent to
the url in JBoss.
Thank you, for the detailed response.
Gonzalo Odiard
rfincher2000 wrote:
>Hi Gonzalo,[Non-text portions of this message have been removed]
>
>Tomcat 5.5.X has connection pooling built in, so be sure you don't add
>any commons jars for DBCP to the ones already in the Tomcat setup or
>it will mess things up.
>
>All you have to do is put firebirdsql-full.jar in
>$CATALINA_home/common/lib, then put a context configuration file in
>named "context.xml" in The WEB-INF directory of your web app.
>
>A minimal one for Jaybird looks like this:
>
><Context path="/dbTest" docBase="dbTest" debug="1" reloadable="true">
><Resource name="jdbc/dbTest" auth="Container" type="javax.sql.DataSource"
>username="sysdba"
>password="masterkey"
>driverClassName="org.firebirdsql.jdbc.FBDriver"
>url="jdbc:firebirdsql://localhost:3050/c:\\databases\\TEST.GDB"
>maxWait="-1" />
></Context>
>
>This is for a Windows server (note the double '\\' after c:) you'll
>need to change that for yours to:
>
>jdbc:firebirdsql://localhost:3050//home/bases/proyectos/proyectos.gdb
>
>
>Tomcat 5 will use that to build the DataSource for your web app.
>
>In the Tomcat docs you can look up all the additional tags you can use
> in context.xml associated with the DataSource and pooling.
>Verification SQL strings and RemoveAbandonded are good to use.
>
>The web.xml file hasn't changed much for Tomcat 5.5 but here is the
>DataSource snippet just in case:
>
> <resource-ref>
> <description>Test SQL 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>
>
>
>
>You may need to slightly change your code for accessing the dataSource
>in your app.
>
>For the above example it looks like:
>
>DataSource ds=null;
>Connection conn=null;
>
>try
> {
> Context initCtx = new InitialContext();
> Context envCtx = (Context) initCtx.lookup("java:comp/env");
>
>
> if(envCtx == null )
> throw new Exception("Boom - No Context");
>
> ds = (DataSource) envCtx.lookup("jdbc/dbTest");
>
>
> try
> {
> conn = ds.getConnection();
> }
> catch (SQLException se)
> {
> System.out.println("getting new data source connection failed!
>Error: "+se+"\n");
> }
>
> }
> catch (Exception e)
> {
> System.out.println("Could Not get data source, error: "+e+"\n");
> }
>
>Hope this helps!
>
>
>
>Rick
>
>
>
>--- In Firebird-Java@yahoogroups.com, Gonzalo Odiard <go@t...> wrote:
>
>
>>Hi, i have my applications working ok in JBoss 3.x and 4.0.x with
>>
>>
>Firebird,
>
>
>>but i want to work in Tomcat and can't make a connection pool.
>>I have tried with diferent methods, seting the pool in the
>>
>>
>server.xml of
>
>
>>tomcat or in the context.xml file in the application, but with out luck.
>>I am setting the parameter
>>
>>
>driverClassName=org.firebirdsql.jdbc.FBDriver
>
>
>>is that correct?
>>The jar file i am using is firebirdsql.jar, but i have tried
>>firebirdsql-full.jar too.
>>Always obtain the same error:
>>
>>org.apache.commons.dbcp.SQLNestedException:
>>Cannot create JDBC driver of class 'org.firebirdsql.jdbc.FBDriver' for
>>connect URL '127.0.0.1/3050:/home/bases/proyectos/proyectos.gdb', cause:
>>java.sql.SQLException: No suitable driver
>> at java.sql.DriverManager.getDriver(DriverManager.java:243)
>> at
>>
>>
>>
>org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:743)
>
>
>> at
>>
>>
>>
>org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
>
>
>>Any idea?
>>
>>Thanks
>>
>>Gonzalo Odiard
>>
>>P.D: I have tried all the methods in
>>
>>http://www2.theserverside.com/discussions/thread.tss?thread_id=25459
>>
>>http://forum.java.sun.com/thread.jspa?messageID=3175042�
>>
>>http://www.theserverside.com/discussions/thread.tss?thread_id=29795
>>
>>
>
>
>
>
>
>
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>