Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 71093 - Working with the data sources
Working with the data sources
Product: serverplugins
Classification: Unclassified
Component: JBoss
All All
: P1 (vote)
Assigned To: Libor Kotouc
: 71092 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2006-01-06 14:42 UTC by Libor Kotouc
Modified: 2007-09-17 21:36 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Libor Kotouc 2006-01-06 14:42:14 UTC
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).

add 1. 
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.
Comment 1 Libor Kotouc 2006-01-06 14:46:29 UTC
*** Issue 71092 has been marked as a duplicate of this issue. ***
Comment 2 Libor Kotouc 2006-01-06 14:58:59 UTC
Using JMx when detecting data source existence implies a server to be in the
running state.
Comment 3 Chris Webster 2006-01-06 17:38:44 UTC
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 ?
Comment 4 Libor Kotouc 2006-01-06 17:51:10 UTC
This RFE is for working with databases. I cannot say now whether we will do
other types.

And yes, the support will deploy the data source definition to the target server.
Comment 5 Libor Kotouc 2006-01-07 12:47:00 UTC
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').
Comment 6 Libor Kotouc 2006-01-09 10:14:01 UTC
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.

Comment 7 Libor Kotouc 2006-01-09 16:51:48 UTC
Branch for this issue was created:

branch root:

branch name:
Comment 8 Libor Kotouc 2006-01-23 15:10:21 UTC
- 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.
Comment 9 Jiri Prox 2007-09-17 21:36:09 UTC
Obsolete milestone, please reevaluate

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo