In this week's part of a multi-part series covering OC4J and J2EE applications, you will learn how to deploy J2EE applications, create data sources, and more. This article is excerpted from chapter eight of the Oracle 10g Application Server Exam Guide, written by Sam Alapati (McGraw-Hill; ISBN: 0072262710).
Oracle recommends that you use consistent and meaningful naming conventions when developing Web applications. You must create your applications as a set of modules and place them under a directory that’s named for the application. All your directories under the main application directory should be consistent with the directory structure for creating the necessary JAR, WAR, and EAR archives to facilitate the archiving of the application modules. Here’s the standard development application directory structure for J2EE-based Oracle applications:
Note that the application.xml file, which is the main application descriptor file, defines each of the modules. When you create a directory structure such as the one shown here, the modules are easily distinguishable from each other. For example, the EJB package class "testapp.ejb.Prod" should be located in the directory <testapp>/<ejb_module>/testapp/ejb/Prod.class.
Deployment Methodologies
As mentioned previously, you can deploy Web applications as well as EJB applications through OC4J. You can deploy applications through the Application Server Control, or by using the dcmctl utility. The recommended approach is to use the Application Server Control. You can also deploy applications by manually editing the configuration files, of course, as well as by unpacking the deployment archive files in their deployment directories.
Data Sources
A data source is an object that lets you retrieve a connection to a database server. Data sources are encapsulations of connections to a database server, and they are instantiations of objects implementing the javax.sql.dataSource interface. Data source objects are bound to the JNDI name space, and the J2EE applications use the JNDI tree to look up various DataSource objects. Data sources offer you portable methods for creating JDBC connections across servers.
on the job: Because of their vendor-independent nature, Oracle Corporation recommends that you use data sources to retrieve database server connections.