There is a need to define the datasource when a user wants to use some
enterprise resources, e.g. 'Use Database'.
There are basically two parts:
1. create a data source within the project's target server (if it is not there
2. bind the server-specific deployment descriptor with this data source
It will vary for the web and EJB project, AFAIK at least the server-specific
descriptors are different but the mechanism stays same.
The question is which use cases will be involved in addition to 'Use Database'
on the Servlet. One possibility is when a user imports or creates an entity
bean, but I don't know now whether there will be implemented for EJB3.0 only or
whether it will work also for EJB2.1 (if there is a difference at all).
A. We will need to detect the DS existence. The datasource can be defined in a
separate XML file in the deploy subdirectory (JBoss uses a convention
<db-type>-ds.xml) but it is probably possible to add the definition into an
existing file, e.g. to some other data source definition. It can be perhaps
placed under another directory then deploy.
So, one way is to use some file searching heuristic to find the data source.
Another way is to use JMX interface, I must to explore it a little bit to find
out some good mechanism - the most reliable way could be finding the database
driver in the DS with the same name as a project generates.
B. Another problem is when the data source should be deployed (by copying in
fact), whether immediatelly after its creation or during a project deploy.
*** Issue 71092 has been marked as a duplicate of this issue. ***
Using JMx when detecting data source existence implies a server to be in the
Will the JBoss plug-in support also handle JMS type interactions for MDB or is
this RFE only for DataBase type connections. Also, will the support deploy the
appropriate drivers to the JBoss server ?
This RFE is for working with databases. I cannot say now whether we will do
And yes, the support will deploy the data source definition to the target server.
JBoss does not bind the data sources to 'java:comp/env', but only to 'java:'
namespace. Thus we must map the generated datasource (say jdbc/MyDatabase)
through a server-specific deployment descriptor to the real JNDI name like this
This works for the servlets where a web project generates lookup for
'java:/comp/env/jdbc/MyDatabase' and even for the JSP pages where the JSTL
sql:query tag is used (JSTL 1.1 implementation prefixes the given dataSource
attribute with 'java:comp/env').
To adding a data source to a target server:
it would be nice to place the appropriate driver into a target server, too. The
JBoss server does not listen on the lib directory changes by default, thus a
server must be restarted before deploying a data source.
Also, we must detect a situation when a user changes a data source in a project
(driver class) and then not to copy the driver class.
Branch for this issue was created:
- tag on the issue71093_branch BEFORE merging it into javaee5 branch:
- tag on the javaee5 branch BEFORE merging it with issue71093_branch branch:
- tag on the javaee5 branch AFTER merging it with issue71093_branch branch:
Changes between issue71093_branch_root and
issue71093_branch_before_merge_to_javaee5 were merged into javaee5 branch =>
result tag name is javaee5_after_merge_with_issue71093_branch.
Obsolete milestone, please reevaluate