Enterprise Tech Tip: DataSource Resource Definition in Java EE 6

Java EE 6 has a wide variety of new features that makes enterprise and web application development a lot easier. I covered many of these features in the article Introducing the Java EE 6 Platform. However, one of the areas of improvement in Java EE 6 that I didn't cover in that article is datasource resource definition.

If you've accessed relational databases through the JDBC API, you know all about DataSource objects. For those of you who aren't familiar with DataSource objects, they're Java objects that identify and describe real-world data sources such as relational databases. To access a datasource, you need to define a DataSource object and register it with the Java Naming and Directory Interface (JNDI) naming service. An application can then use the JNDI API to access that DataSource object, which can then be used to connect to the datasource it represents.

Prior to Java EE 6, you could create a DataSource object only through vendor-specific mechanisms, such as commands. However, Java EE 6 makes datasource definition more flexible. It introduces a new datasource definition resource that you can declare portably for database connectivity across any Java EE 6-compatible application server. You can declare datasource definitions either through annotations or through the use of deployment descriptors.

Jagadish Ramu, an engineer in the GlassFish Application Server team, has written a very nice Tech Tip that describes this new capability in more detail and shows code examples that demonstrate datasource definition using annotations and deployment descriptors. The tip also includes a sample application that demonstrates the use of these features. See the tip DataSource Resource Definition in Java EE 6.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

edort

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today