Subject Problems with FBWrappingDataSource and JNDI
Author herve_soulard
Hello,

I'm trying to use JayBird instead of Interclient and I have some
problems using FBWrappingDataSource with JNDI. Here is the code I
use:

String JNDI_FACTORY = "com.sun.jndi.fscontext.RefFSContextFactory";
FBWrappingDataSource dbDataSource = null;

Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
context = new InitialContext(props);

try {
// Try to get DataSource from JNDI.
dbDataSource = (FBWrappingDataSource)context.lookup("jdbc/test");
} catch (NameNotFoundException e) {
// Doesn't work so create it.
dbDataSource = new FBWrappingDataSource();
dbDataSource.setDatabase("localhost/E:/Java/test.gdb");
dbDataSource.setUserName("sysdba");
dbDataSource.setPassword("masterkey");
context.bind("jdbc/test", dbDataSource);
}

It used to work fine with Interclient
(interbase.interclient.DataSource instead of
FBWrappingDataSource) but now fails in context.lookup(). Instead of
getting back a FBWrappingDataSource, I get a javax.naming.Reference.
Could you help me on this issue?

I'm using JayBird 1.5 (with 1.0 I get a Null exception in
context.bind because the JNDI reference is Null) and JDK 1.3.1.

Regards,

Hervé Soulard.