|
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"
|
JDBC (URGENT): Can only bind References or Referenceable objects
eCommerce Software Solns. Inc. Sat, 14 Dec 2002 11:49:32 -0800
- RE: JDBC (URGENT): Can only bind References... eCommerce Software Solns. Inc.
- RE: JDBC (URGENT): Can only bind Refer... Schroeder, Alexander
