Hi,
I am trying to connect to Oracle data source from
EJB in WebSphere 5. The same code is working in WSAD 5.1.
Actually, I am using
JSP to call EJB to access Oracle DB using Oracle datasource. The EJB code to get Oracle DB connection is like:
------------------
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/OraDSN");
System.out.print("DataSource is: "+ds.toString());
Connection Conn = ds.getConnection("Username","Password");
------------------
I have created "jdbc/OraDSN" in WebSphere server. One thing to be observed is when I try to use the same code in a JSP, its working and connecting to database, but its not connecting from a EJB.
The error I got was:
J2CA0046E: Method createManagedConnctionWithMCWrapper caught an exception during creation of the ManagedConnection for resource jdbc/WebDLR_JNDI, throwing ResourceAllocationException. Original exception: com.ibm.ws.exception.WsException: Subject was not null but no valid credentials were found...............................
54667916 ConnectionMan E J2CA0020E: The Connection Pool Manager could not allocate a Managed Connection: javax.resource.spi.ResourceAllocationException: Caught ResourceException thrown during creation of the ManagedConnection........................
java.sql.SQLException: DSRA9002E: ResourceException with error code null: javax.resource.spi.ResourceAllocationException: Caught ResourceException thrown during creation of the ManagedConnection.
I am using JSP, EJB 2.0 with CMP, Stateless session bean to connect to DB, ORacle thin driver, Oracle 8.1.7, WS 5.0, WSAD 5.1
Please let me know if anyone has a solution for my issue.
Thanks,
Chandra