geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ueberbach, Michael" <>
Subject Lookup for Datasource
Date Tue, 06 Dec 2005 08:11:09 GMT

I'm using geronimo M5 and have a question about the deploying of an EJB application.
I already delpoyed a J2EE connector as a global connection to an existing Mysql database.
Also I deloyed a simple stateless session bean that may be part of a greater EJB application.
This session bean should retrieve data from the database directly (JDBC for reading).
I managed to do this while making a lookup to the datasource the following way:

InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/MysqlDataSource");

Here "MysqlDataSource" is the name of the connection defined in the deployment plan for the
above mentioned


Now I would like to replace the name of the connection by a logical name, let's say this way:

DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DataSource");

Therefore a link between the alias "jdbc/DataSource" and the connection "MysqlDataSource"
has to be
established elswhere.

I found an example of such a link in the following deployment plan


But this is the plan for a web application and I want to deploy a simple EJB application.
neccessary openejb-jar.xml does not allow such a link.
So where to put it?

Thanks a lot

View raw message