|
Deploy a Web Application with OC4J
OC4J is an Oracle 9i AS component that gives you a stand-alone test environment for developing and testing EJBs, servlets, and JSPs
by David Gallardo
September 2003 Issue
Editor's note:
This article was excerpted from chapter 10, Introduction to J2EE Persistence in Java Oracle Database Development by David Gallardo (Prentice Hall PTR, 2002, used with permission). The author created a music CD application example that is used in this selection. Although the specifics of building this app to this point are not included here, we hope the basic principles will be comprehensible to most readers.
Databases are unavoidable. That's probably the most important lesson I've learned in all my years as a programmer. I never explicitly sought out database-related development work at first; it always seemed to find me. I tried to pursue other technologies and avoid databases, but because of personal and general technological circumstances, was never entirely successful. Finally, I've learned it's best to accept database programming and enjoy it. I'm much happier now.
In discussing database programming here I stress the standards-based, open-source, cross-platform approach that Java encourages. You may therefore justifiably question why I concentrate solely on Oracle. The answer is that, unfortunately, the standards for relational databases, in particular the SQL standards, are weak. No major database is fully compliant with SQL, and all require you to use proprietary extensions in one way or another. I believe, therefore, that choosing to limit this discussion to Oracle, yet making it clear what is a proprietary and what is a standard feature is a fair compromise. To use quasi-object-oriented terms, you might think of database programming as an abstraction and Oracle database programming as an instantiation of that abstraction.
There are a number of reasons for choosing Oracle over other databases, but free, easy availability is a very immediate and practical one for developers seeking to learn database programming. All Oracle software and their documentation are freely available for download on the Internet (or on CD for minimal cost) for evaluation and noncommercial development purposes. With that, let's turn to the crux of this discussion: OC4J, the Oracle Containers for Java 2 Platform, Enterprise Edition (J2EE).
OC4J is a key component of Oracle 9i AS. Oracle 9i AS is a comprehensive package of components for building robust, scalable Web and multitier applications, but OC4J is, in itself, what is normally referred to as an application server. (OC4J is, in fact, the Orion application server, which Oracle has licensed and rebranded.) It is the only component needed for developing and testing Enterprise JavaBeans (EJBs), servlets, and Java Server Pages (JSPs). You should not need to download and install the entire Oracle 9i AS suite to obtain OC4J. Not only can OC4J be downloaded and installed individually, but it also comes bundled with the Oracle 9i database and with Oracle JDeveloper. Because the EJB examples we'll discuss will use JDeveloper, I recommend that you use the version of OC4J that comes with JDeveloper.
After downloading the JDeveloper zip files from Oracle, installation is as simple as unzipping it into the directory of your choice, such as c:\jdev. There is no installation or setup program to run. The OC4J stand-alone server's home directory will be c:\jdev\j2ee\home. This OC4J directory is separate from the OC4J server embedded in JDeveloper, so we won't have to worry that making changes will cause problems with JDeveloper. It provides us with a separate, stand-alone test environment to which we can deploy J2EE applications after debugging in the integrated JDeveloper environment.
Back to top
|