Subject Re: [IB-Java] Re: Firebirdsql and Jboss Connection pooling, how to use it?
Author David Jencks
On 2002.01.10 18:49:16 -0500 jwcanada wrote:
> David,
>
> I use Tomcat 4. I believe it has jndi provider.
>
> jw
> --- In IB-Java@y..., David Jencks <davidjencks@d...> wrote:
> >
> > If you tell me what setup you are thinking of I will try to give you
> > advice, although I probably won't be able to test it.
> >
> > e.g. servlet engine, whether you are running it integrated with
> jboss, and
> > if not what jndi provider.
> >
> > Thanks
> > david jencks
> > >
>

I think executing code like this on container startup will work:

private final static String DB_DATASOURCE_URL =
"localhost/3050:tmp/testfb.gdb";
private final static String DB_USER = "sysdba";
private final static String DB_PASSWORD = "masterkey";
private final static String JNDI_NAME = "java:/firebirdSQLDS";



FBWrappingDataSource ds = new FBWrappingDataSource();
ds.setDatabaseName(DB_DATASOURCE_URL);
ds.setUser(DB_USER);
ds.setPassword(DB_PASSWORD);
ds.setMinSize(3);
ds.setMaxSize(5);
ds.setBlockingTimeout(1000);
ds.setIdleTimeoutMinutes(15);
ds.setPooling(true);

InitialContext ctx = new InitialConext();
ctx.bind(JNDI_NAME, ds);

Note that the db url is not a jdbc url and DOES NOT have jdbc:firebirdsql:
at the beginning.

If you need each user to log on as themselves, I recommend not using
pooling, unless you know for sure the maximum number of users. Each user
gets up to maxsize connections, rather than maxsize being the total number
of connections available for everyone together.

I don't know what facilities tomcat provides for running code at startup.
This is one of the nice things about the jboss mbean architecture, it is
very easy.

david jencks