Hi,
I've found this code in a manual of websphere, but it seems that it doesn't find jdbc\OracleSample:
Could you help me, please? I would be very grateful.
// Retrieve a DataSource through the JNDI Naming Service
java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
// Create the Initial Naming Context
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
// Lookup through the naming service to retrieve a DataSource object
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/OracleSample");
// Obtain a Connection from the DataSource
java.sql.Connection conn = ds.getConnection();
// Retrieve a DataSource through the JNDI Naming Service
java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
// Create the Initial Naming Context
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
// Lookup through the naming service to retrieve a DataSource object
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/OracleSample");
// Obtain a Connection from the DataSource
java.sql.Connection conn = ds.getConnection();
If I write:
ctx.lookup("jdbc/OracleSample"); I get:
Error 500: DSRA9002E: ResourceException con código de error null: javax.resource.spi.ResourceAllocationException: Caught ResourceException thrown during creation of the ManagedConnection. at
In the server configuration, I've created in JDBC Provider List:
Name: OracleDriver
Implementation class name: oracle.jdbc.pool.OracleDataSource
Classpath: c:\oracle\ora92\jdbc\lib\classes12.zip
c:\oracle\ora92\jdbc\lib\nls_charset12.jar
Native Path: C:\oracle\ora92\jlib\jndi.jar
I've created a DataSource:
Name: DataSourceOracle
JNDIName: jdbc/OracleSample
I've refilled:
driverType: thin
databasename: SID
serverName: maquina
portNumber: puerto
Url: jdbcracle:thin@maquinauerto:SID
I work with Oracle9i
Thanks in advance.
Davinia.
I've found this code in a manual of websphere, but it seems that it doesn't find jdbc\OracleSample:
Could you help me, please? I would be very grateful.
// Retrieve a DataSource through the JNDI Naming Service
java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
// Create the Initial Naming Context
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
// Lookup through the naming service to retrieve a DataSource object
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/OracleSample");
// Obtain a Connection from the DataSource
java.sql.Connection conn = ds.getConnection();
// Retrieve a DataSource through the JNDI Naming Service
java.util.Properties parms = new java.util.Properties();
parms.setProperty(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
// Create the Initial Naming Context
javax.naming.Context ctx = new javax.naming.InitialContext(parms);
// Lookup through the naming service to retrieve a DataSource object
javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/OracleSample");
// Obtain a Connection from the DataSource
java.sql.Connection conn = ds.getConnection();
If I write:
ctx.lookup("jdbc/OracleSample"); I get:
Error 500: DSRA9002E: ResourceException con código de error null: javax.resource.spi.ResourceAllocationException: Caught ResourceException thrown during creation of the ManagedConnection. at
In the server configuration, I've created in JDBC Provider List:
Name: OracleDriver
Implementation class name: oracle.jdbc.pool.OracleDataSource
Classpath: c:\oracle\ora92\jdbc\lib\classes12.zip
c:\oracle\ora92\jdbc\lib\nls_charset12.jar
Native Path: C:\oracle\ora92\jlib\jndi.jar
I've created a DataSource:
Name: DataSourceOracle
JNDIName: jdbc/OracleSample
I've refilled:
driverType: thin
databasename: SID
serverName: maquina
portNumber: puerto
Url: jdbcracle:thin@maquinauerto:SID
I work with Oracle9i
Thanks in advance.
Davinia.