Re: How to connect to a data source from a session bean?
Ling Chen wrote:
>After I changed the code to
>>Context context = new InitialContext();
>I still cannot connect to the datasource, the exception is:
> RemoteException occurred in server thread; nested exception is:
>java.rmi.RemoteException: ; nested exception is:
>javax.ejb.EJBException: Unable to connect to database. Exception
>occurred while the JNDI NamingManager was processing a
>The settings I have in the Studio are:
>Under the server setting, I have
> "ds1" ( name )
> "jdbc/ds1" (JNDI name)
>for a Cloudscape JDBC Driver datasource.
>Under the session bean's setting, I added a ResourceRef to the data
> "jdbc/ds1" (name)
> "javax.sql.DataSource" (type)
> "Shareable"(Sharing scope)
> "jdbc/ds1"(JNDI name)
>I didn't specify anything under WebSphere Extensions.
>If you are able to connect to a jdbc datasource from a EJB using jndi
>lookup, please let me know.
It looks like you ARE connecting to the datasource. Which can't connect
to the database.