Sun Java System Web Server 6.1 SP12 Administrator's Guide

About J2SE Naming Services and Resources

Web applications access a wide variety of resources such as resource managers, data sources (for example SQL datasources), mail sessions, and URL connection factories. The J2SE platform exposes such resources to the applications by using Java Naming and Directory Interface (JNDI) service.

Sun Java System Web Server allows you to create and manage the following J2SE resources:

JDBC Datasources

A JDBC datasource is a J2SE resource that you can create and manage using Sun Java System Web Server.

The JDBC API is the API for connectivity with relational database systems. The JDBC API has two parts:

A JDBC datasource object is an implementation of a data source in the Java programming language. In basic terms, a data source is a facility for storing data. It can be as sophisticated as a complex database for a large corporation or as simple as a file with rows and columns. A JDBC Datasource is a J2SE resource that can be created and managed via Sun Java System Web Server.

The JDBC API provides a set of classes for Java with a standard SQL database access interface to ensure uniform access to a wide range of relational databases.

Using JDBC, SQL statements can be sent to virtually any DBMS. It is used as an interface for both relational and object DBMSs.

For information on creating a custom resource, see Creating a JDBC Resource.

JDBC Connection Pools

A JDBC connection pool is a named group of JDBC connections to a database. These connections are created when the first request for connection is made on the pool when you start Sun Java System Web Server.

The JDBC connection pool defines the properties used to create a connection pool. Each connection pool uses a JDBC driver to establish a connection to a physical database at server start-up.

A JDBC-based application or resource draws a connection from the pool, uses it, and when no longer needed, returns it to the connection pool by closing the connection. If two or more JDBC resources point to the same pool definition, they will be using the same pool of connections at run time.

For information on how to create a new JDBC connection pool, see Creating a New JDBC Connection Pool.

Java Mail Sessions

JMS destinations are J2SE resources that can be created and managed by using Sun Java System Web Server.

Several internet applications require the ability to send email notifications. The J2SE platform includes the JavaMail API along with a JavaMail service provider that allows an application component to send internet mail. The JavaMail API has two parts:

Java Mail Sessions are J2SE resources that can be created and managed by using Sun Java System Web Server.


Note –

Sun Java System Web Server does not provide an Administration Server interface to create Java Mail Sessions. You can use the command line interface to do so. For more information on how you can create a mail resource using the command line utility, see Create Mail Resource.


Custom Resources

A custom resource accesses a local JNDI repository. The customresource element defined in server.xml provides a way of specifying a custom server-wide resource object factory. Such object factories implement the javax.naming.spi.ObjectFactory interface. This element associates a JNDI name (specified through the jndiname sub-element like other Sun Java System Web Server resources) to be used in the server-wide namespace, its type, name of the resource factory class and a set of standard properties used to instantiate the same.

You need to ensure that the resource reference’s environment references are linked to the configured server-wide resources defined using the customresource and externaljndiresource tags in server.xml. Dynamic redeployment of application components is an issue for the JNDI naming environment. Sun Java System Web Server will release all the application specific references and rebind all the new references into the newly installed application’s naming context.

For information on creating a custom resource, see Creating Custom Resources.

External JNDI Resources

Often applications running on Sun Java System Web Server require access to resources stored in an external JNDI repository. For example, generic Java objects could be stored in an LDAP server as per the Java schema. While a custom resource allows you to access a local JNDI repository, to access an external JNDI repository you must use an external JNDI resource. An external JNDI factory must implement the javax.naming.spi.InitialContextFactory interface.

For information on creating an external JNDI resource, see Creating External JNDI Resources.