Subject Re: Problem with connections and Tomcat JNDI
Author bradenw2
That was indeed the problem ... thanks for the quick replies and
congrats to you and your team for the work you've done so far. It's
nice to be closer to freedom from Interserver, in my opinion ...

BTW, a quick examination of the code for FBDataSourceObjectFactory has
MinSize and MaxSize being defaulted to 0:

...
if (dbName == null)
{
throw new IllegalArgumentException("You must supply a db name");
} // end of if ()
ds.setDatabaseName(dbName);
ds.setUser(get(ref, "User", null));
ds.setPassword(get(ref, "Password", null));
ds.setMinSize(Integer.parseInt(get(ref, "MinSize", "0")));
ds.setMaxSize(Integer.parseInt(get(ref, "MaxSize", "0")));
ds.setBlockingTimeout(Integer.parseInt(get(ref, "BlockingTimeout",
"5000")));
ds.setIdleTimeoutMinutes(Integer.parseInt(get(ref,
"IdleTimeoutMinutes", "30")));
ds.setPooling(true);
...

A bug/oversight, perhaps?

BW

P.S. Is anyone out there documenting this configuration? I can
certainly write up a quick-start kind of document for this
configuration if the need is there ...



--- In Firebird-Java@y..., David Jencks <davidjencks@d...> wrote:
> The exception comes from driver pooling code before any attempt to
> establish a connection is made. I think maxsize must be getting set
to 0.
> Please try explicitly setting it to a positive value.
>
> thanks
> david jencks
>
> On 2002.04.02 17:19:03 -0500 bradenw2 wrote:
> > Yes, I get the problem on the very first attempt to get a connection.
> >
> > I am definitely getting a DataSource object, it is the call to the
> > getConnection() method that is throwing a SQLException with a Resource
> > Exception nested within (I had to dig into a running VM to get the
> > original message).
> >
> > Does that particular error message originate from Firebird itself, or
> > is this all still within the Java driver complex?
> >
> > BW
> >
> > --- In Firebird-Java@y..., David Jencks <davidjencks@d...> wrote:
> > > 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@y...
> > > >
> > > >
> > > >
> > > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > > >
> > > >
> > > >
> >
> >
> >
> > To unsubscribe from this group, send an email to:
> > Firebird-Java-unsubscribe@y...
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
> >
> >
> >
> >
> >