|
Hello,
it is
because the current implementation does not implement
javax.naming.Referenceable, as no
other
application currently using it had really a need for it.
I'll
put it on the list, but don't hold your breath.
Regards
Alexander Schr�der
SAP
Labs Berlin
I want urgent help to understand how I can use a JDBC data source with
SAPDB.
I am trying to bind a SAPDB data source (class DataSourceSapDB) to
File System JNDI Context.
This is my code - standard Java code for binding:
package
com.ess.shared.util.db.dsRegistration;
import
java.util.Hashtable;
import javax.naming.Context;
import
javax.naming.InitialContext;
import javax.sql.DataSource;
import com.sap.dbtech.jdbcext.*;
public class SapDB {
static
public
void main(String
[] args)
throws
Exception
{
DataSourceSapDB ds;
Context ctx;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
ctx = new
InitialContext(env);
System.out.println( "Context is:
" + ctx);
ds = new
DataSourceSapDB();
System.out.println( "DataSource is:
" + ds);
//ds.setServerName("Vin");
ds.setUrl( "jdbc:sapdb://localhost/SAPAMSDB?trace=e:\\sapdbLocal.log");
//ds.setPort(3306);
//ds.setDatabaseName("DBAMSDB");
ds.setUser( "scott");
ds.setPassword( "tiger");
ctx.bind( "java:/AMSDB_SAP_LOCAL", ds);
ctx.close();
}
}
I get the following exception:
Context is: javax.naming.InitialContext@74a24a
DataSource is:
com.sap.dbtech.jdbcext.ConnectionPoolDataSourceSapDB@360be0
javax.naming.OperationNotSupportedException: Can only bind References or
Referenceable objects
at
com.sun.jndi.fscontext.RefFSContext.addObjectToBindings(RefFSContext.java:479)
at
com.sun.jndi.fscontext.RefFSContext.bindObject(RefFSContext.java:337)
at com.sun.jndi.fscontext.RefFSContext.bind(RefFSContext.java:169)
at com.sun.jndi.fscontext.FSContext.bind(FSContext.java:167)
at javax.naming.InitialContext.bind(InitialContext.java:358)
at com.ess.shared.util.db.dsRegistration.SapDB.main(SapDB.java:30)
Exception in thread "main"
|