javaee / javaee-spec

Java EE Platform Specification
https://javaee.github.io/javaee-spec
Other
389 stars 69 forks source link

Define platform default JDBC data source #4

Closed glassfishrobot closed 12 years ago

glassfishrobot commented 12 years ago

Currently several Java EE implementations ship with an embedded database that is often also made available to user code via a pre-defined data source.

The JNDI name under which this data source is made available differs per product. For instance GlassFish V3 uses jdbc/_default, JBoss AS 5 and 6 use java:/DefaultDS and JBoss AS 7 uses java:jboss/datasources/ExampleDS. WebLogic and WebSphere ship with embedded databases, but don't seem to have a pre-defined data source.

I would like to propose the introduction of a platform default data source and bind this to a well-known place in the application server's JNDI tree. This data source does not have to be required to be suitable for heavy production use. Instead it should be primarily intended for testing and development purposes, as well as for applications having very moderate persistence requirements (like an admin console that needs to store a few values).

To make use of this platform default data source, the user should not have to configure anything and should not have to manually start the embedded database separately from starting the application server.

A diverse range of services in the Java EE platform that now do persistence in some opaque vendor specific way (like EJB timer persistence or HTTP session persistence) could possibly be mandated to make use of this default data source.

Optionally it might be worth it to specify a portable way to let this default data source point to an external user specified database. In that way, applications and services that are written to work against the default data source can transparently and portably make use of a central database instead of the embedded one. This could also be useful for issues like EJB_SPEC-45, EJB_SPEC-47 and possibly EJB_SPEC-10.

glassfishrobot commented 12 years ago

Reported by arjan_t

glassfishrobot commented 12 years ago

reza_rahman said: Good write-up of the basic underlying problem.

glassfishrobot commented 12 years ago

@bshannon said: This issue is already under discussion in the expert group: http://java.net/projects/javaee-spec/lists/jsr342-experts/archive/2012-03/message/56

glassfishrobot commented 12 years ago

arjan_t said: Thanks reza.

Good to see this is being discussed already. Hope this JIRA issue can contribute to that discussion.

glassfishrobot commented 12 years ago

agoncal said: And what about having a standard CDI qualifier so the container can produce these default resources that we could just inject like that :

@Inject @DefaultResource
DataSource myDS

@Inject @DefaultResource
Topic myTopic
glassfishrobot commented 12 years ago

arjan_t said: +1 for the standard CDI qualifier.

One additional requirement could be that the default data source should not be automatically influenced by any other data sources that an application declares to be using. If I'm not mistaken this is similar to the behavior we're seeing in existing products today. No amount of application defined data sources makes java:/DefaultDS in JBoss AS 5/6 go away or change its behavior.

Specifically, in the presence of application specific data sources the default data source should never be automatically mapped to any of those and it also should not go away.

This extra requirement is especially important if Java EE platform services ((like the mentioned EJB timers), or plugged-in services (like JCA connectors and CDI portable extensions) would adopt the platform default data source. A typical application that defines its own data sources for an external DB would not for example wants the data associated with EJB timers to automatically go to that external DB.

glassfishrobot commented 12 years ago

ldemichiel said: Default data source has been added.

glassfishrobot commented 7 years ago

This issue was imported from java.net JIRA JAVAEE_SPEC-4

glassfishrobot commented 12 years ago

Marked as fixed on Wednesday, August 22nd 2012, 12:52:55 pm