Hi
My system is : Windows XP
Java Standard Edition 6.0 (or 1.6)
and Sun's FileSystemContextProvider (for Jndi)
The Problem is,that i can not store the ClientDataSource and
ClientConnectionPoolDataSource
in the jndi context. A simple code fragment is added here :
import javax.naming.Context;
import import javax.naming.InitialContext;
import org.apache.derby.jdbc.ClientDataSource;
import org.apache.derby.jdbc.ClientConnectionPoolDataSource;
public class test
{
try
{
Context ctx = new InitialContext();
ctx.addToEnvironment( Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory" );
ClientDataSource cds = new ClientDataSource();
// ClientConnectionPoolDataSource cds = new
ClientConnectionPoolDataSource();
cds.setUser("test");
cds.setPassword("test");
cds.setDatabaseName("tests;create=true");
cds.setServerName("localhost");
cds.setPortNumber(1527);
// In method bind (or rebind) it comes to an NullPointerException
ctx.bind( "db/derby/mydatas/test" , cds );
ctx.removeFromEnvironment(Context.INITIAL_CONTEXT_FACTORY);
ctx.close();
}
catch(Exception e)
{
}
}
With other databases, ORACLE,POSTGRES and MYSQL there is no problem to run
this.The DataSource
ist correct stored in the filesystem jndi context.Here an example for Oracle :
mport javax.naming.Context;
import import javax.naming.InitialContext;
import oracle.jdbc.pool.OracleDataSource;
import oracle.jdbc.pool.OracleConnectionPoolDataSource;
public class test
{
try
{
Context ctx = new InitialContext();
ctx.addToEnvironment( Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory" );
OracleDataSource cds = new OracleDataSource();
// OracleConnectionPoolDataSource cds = new
OracleConnectionPoolDataSource();
cds.setUser("test");
cds.setPassword("test");
cds.setURL("jdbc:oracle:thin:@localhost:1521:tests");
// In method bind (or rebind) it comes to an NullPointerException
ctx.bind( "db/oracle/mydatas/test" , cds );
ctx.removeFromEnvironment(Context.INITIAL_CONTEXT_FACTORY);
ctx.close();
}
catch(Exception e)
{
}
}
Die etwas anderen Infos rund um das Thema Reisen. BE A BETTER
WELTENBUMMLER! www.yahoo.de/clever