Book Image

Java EE Development with Eclipse

By : Deepak Vohra
Book Image

Java EE Development with Eclipse

By: Deepak Vohra

Overview of this book

<p>Java EE is the industry standard on enterprise computing and Oracle WebLogic Server is the most comprehensive platform for enterprise applications. The book combines Java EE with WebLogic Server in the most commonly used Java IDE, the Eclipse IDE 3.7.<br /><br />"Java EE Development with Eclipse" is the only book on Eclipse IDE for Java EE Developers. The book is a practical guide for using the most commonly used Java EE technologies and frameworks in Eclipse IDE. Sample applications are available in downloadable format and may be customized to meet requirements. Oracle Enterprise Pack for Eclipse 12c, an enhancement to Eclipse IDE, providing additional project facets and an integrated support for Oracle WebLogic Server is used.<br /><br />"Java EE Development with Eclipse" is based on developing applications with some of the commonly used technologies using the project facets in Eclipse 3.7 and its enhancement Oracle Enterprise Pack for Eclipse 12c. <br /><br />The book starts with a discussion on EJB 3.0 database persistence with Oracle database XE and Oracle WebLogic Server. JAXB is discussed in the context of bi-directional mapping between XML and Java. A generic web project is developed for PDF and Excel spread sheet reports. JavaServer Faces, the most commonly used view component in web applications is discussed for developing a data table. Facelets, which was integrated into JSF with 2.0 version is discussed in the context of templating. ADF Faces components are used to develop another user interface (UI) application. Web services are discussed with JAX-WS and JAX-RS technologies. Java EE frameworks Ajax and Spring are also discussed.</p>
Table of Contents (17 chapters)
Java EE Development with Eclipse
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Configuring a data source


In this section we shall configure a data source in Oracle WebLogic Server 12c. First, download and install the Oracle WebLogic Server from http://www.oracle.com/technetwork/middleware/ias/downloads/wls-main-0971. Configure the base_domain structure in the WebLogic Server console. We need to create a data source so that when we deploy and run the application in the server, the application has access to the database. Log in to the WebLogic Server Administration Console server for the base_domain domain using the URL http://localhost:7001/Console. In the base_domain domain structure, expand the Services tab and select the Data Sources node. In the Data Sources table, click on New and select Generic Data Source as shown in the following screenshot:

In Create a New JDBC Data Source, specify a data source name and JNDI Name (for example, jdbc/OracleDS) for the data source. The database shall be accessed using JNDI Name lookup in the Creating a session bean facade section. Select Database Type as Oracle and click on Next as shown in the following screenshot:

In JDBC Data Source Properties, select Database Driver as Oracle's Driver (Thin XA). Another JDBC driver may also be selected based on requirements. Refer to the Selection of the JDBC Driver document available at http://docs.oracle.com/cd/E14072_01/java.112/e10590/keyprog.htm#i1005587 for selecting a suitable JDBC driver. Click on Next as shown in the following screenshot:

By default, an XA JDBC driver supports global transactions and uses the Two-Phase Commit global transaction protocol. Global transactions are recommended for EJBs using container managed transactions for relation between the JDBC driver (XA or non-XA) transactionality and EJB container managed transactions. Click on Next as shown in the following screenshot. (for more information on global transactions, refer http://docs.oracle.com/cd/E23943_01/web.1111/e13737/transactions.htm):

Specify Database Name as XE, Host Name as localhost, Port as 1521, Database User Name and Password as OE, and click on Next as shown in the following screenshot:

The Driver Class Name textbox and connection URL textbox get configured. Click on the Test Configuration button to test the database connection. If a connection gets established the message Connection test succeeded. gets displayed. Click on Next as shown in the following screenshot:

In Select targets, select the AdminServer option and click on Finish. A data source gets added to the data sources table. The data source configuration may be modified by clicking on the data source link as shown in the following screenshot: