Subject Re: [Firebird-Java] Re: Problem with connections and Tomcat JNDI
Author David Jencks
Your code is obviously looking up the DataSource, and it must have gotten
created more or less successfully. If you don't specify a maxSize you
should be able to get 10 simultaneous connections. You might try
explicitly specifying the maxsize as another parameter.

I don't think this can be a connection string issue since the error message
comes from a queued semaphore running out of permits. Are you sure you get
this problem the first 10 times you ask for a connection?

You should definitely close the connection in a finally block, or you will
eventually run out.

conn = ds.getConnection();
try
{
...
}
finally
{
conn.close();
}

david jencks

On 2002.04.02 16:25:15 -0500 bradenw2 wrote:
> Oops. I pasted the wrong version of the server.xml file. Those
> "jdbc/KatanaDB" should read "java:/KatanaDB".
>
> BW
>
>
> --- In Firebird-Java@y..., "bradenw2" <braden.walters@s...> wrote:
> > (Hopefully THIS post will go through ... sheesh!)
> >
> > Hello all,
> >
> > I have been working with the JCA-JDBC in a Tomcat 4 environment, and
> > am making some progress. However, currently when I try to get a
> > database connection, I get a ResourceException with the message that
> > "No ManagedConnections Available!".
> >
> > Here is my server.xml file (relevant portions anyway):
> >
> > <Context path="/katana" docBase="katana" >
> > <Resource name="jdbc/KatanaDB" auth="Container"
> > type="org.firebirdsql.FBDataSourceObjectFactory" />
> > <ResourceParams name="jdbc/KatanaDB" >
> > <parameter>
> > <name>factory</name><value>org.firebirdsql.FBDat
> > aSourceObjectFactory</value>
> > </parameter>
> > <parameter>
> > <name>User</name><value>SKK</value>
> > </parameter>
> > <parameter>
> > <name>Password</name><value>skk1</value>
> > </parameter>
> > <parameter>
> >
>
> > <name>DatabaseName</name><value>localhost/3050:/ex
> > port/home/katana/katana.gdb</value>
> > </parameter>
> > </ResourceParams>
> > </Context>
> >
> > ... and here's the accessing code ...
> >
> > try
> > {
> > Context initCtx = (Context) new InitialContext();
> > Context ctx = (Context) initCtx.lookup("java:comp/env");
> > DataSource ds = (DataSource) ctx.lookup("java:/KatanaDB");
> >
> > conn = ds.getConnection();
> > }
> > catch(NamingException ne)
> > {
> > ne.printStackTrace();
> > }
> > catch(SQLException sqle)
> > {
> > sqle.printStackTrace();
> > }
> >
> > ... and finally the relevant portion of the web.xml file ...
> >
> > <resource-ref>
> > <description>
> > Object Factory Reference to the registration DataSource.
> > </description>
> > <res-ref-name>
> > java:/KatanaDB
> > </res-ref-name>
> > <res-type>
> > javax.sql.DataSource
> > </res-type>
> > <res-auth>
> > Container
> > </res-auth>
> > </resource-ref>
> >
> > Any idea what I am missing?
> > Thanks in advance!
> >
> > Braden Walters
>
>
>
> To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>
>