Subject Re: Datasources and JNDI
Author Roman Rokytskyy
> Since JBoss doesn't reveal datasources to clients, I need to place a
> datasource in JNDI myself. While the Jaybird FAQ mentions a
> FBDataSourceObjectFactory class, I can't find it in the rc3 full
> JAR.

FAQ contains outdated info. Since RC3 FBWrappingDataSource class is
also an object factory for itself. Same happens for
FBConnectionPoolDataSource.

> What I do is create a FBWrappingDataSource and set the database URL,
> username, and password, call getDefaultReference(), and bind that to
> a name in JNDI. When I need a connection I lookup that reference,
> create a new FBWrappingDataSource, and call setReference().
>
> The problem is that I can't get a connection from this datasource,
> and when I examine its properties they are all null.
>
> What is the correct way to create a datasource and make it available
> through JNDI?

You have to specify object factory in the JNDI properties (either as
system property or initial context parameter). Then you can bind a
reference or created object. But object factory is essential.

Roman