Wednesday, May 11, 2011

DataSourceDefinition Annotation

DataSourceDefinition Annotation

Apache Derby is the Apache DB subproject, it is entirely written using Java, is an open source relational database, its size is very small, basic engine with JDBC driver is only 2.6MB, it supports the SQL standard, it provides an embedded JDBC drive, it can be embedded into any Java-based applications, Derby also supports common client / server model, it is easy to install and use.

For example, the following annotation creates a datasource definition for a Derby database:
@DataSourceDefinition(name = "java:app/env/Servlet_DataSource",
minPoolSize = 0,
initialPoolSize = 0,
className = "org.apache.derby.jdbc.ClientXADataSource",
user = "APP",
password = "APP",
databaseName = "testdb",
properties = {"connectionAttributes=;create=true"}
)


The datasource definition is uniquely identified by the name element. This is the JNDI name by which the datasource will be registered. Notice that the name specified in the name element begins with a namespace scope, in this case, java:app. Java EE 6 introduces application component environment namespaces, which includes the following scopes.

No comments:

Post a Comment

 
THANK YOU FOR VISITING