Home

RAD v75 - Additional material

 

+

Search Tips   |   Advanced Search

 

The additional material is a Web download of the sample code for this book. This appendix describes how to download, unpack, describe the contents, and import the project interchange file. In some cases the chapters also require database setup; however, if needed, the instructions will be provided in the chapter in which they are needed.

The Web material associated with this book is available in softcopy on the Internet from the IBM Redbooks Web server. Enter the following URL in a Web browser, and then download the two ZIP files from:

ftp://www.redbooks.ibm.com/redbooks/SG247672

Alternatively, you can go to the IBM Redbooks Web site at:

http://www.ibm.com/redbooks

Retrive:

 

Unpacking the sample code

After you have downloaded the two ZIP files, unpack the files to your local file system using WinZip, PKZip, or similar software. For example, we unpacked the 7672code.zip and 7672codesolution.zip files to the C:\ drive, which creates C:\7672code. Throughout the samples, we reference the sample code as if you have unpacked the files to the C drive.

 

Description of the sample code

 

Interchange files with final code

 

Import sample code from a project interchange file

This section describes how to import the Redbooks publication sample code project interchange zip files into RAD v7.5.

To import a project interchange file...

  1. From the Workbench, select...

      File | Import

  2. From the Import dialog, select...

      Other | Project Interchange | Next

  3. When prompted for the path and file name, enter the following:

    From zip file: Click Browse and locate the path and the zip file. For example...

    Project location root: Leave the default workspace location.

  4. After locating the zip file, the projects contained in the interchange file are listed. Select the project(s) that you want to import, and click Finish.

    For example, we select RAD75Java and clicked Finish.



Note that for the RAD75EJBWeb.zip project, after importing, deploy the code again. Right-click the RAD75EJBWeb.zip project and select...

 

Setting up the ITSOBANK database

We provide two implementations of the ITSOBANK database, Derby and DB2. You can choose to implement either or both databases and then set up the enterprise applications to use one of the databases. The Derby database system is shipped with the WebSphere Application Server. We tested the application on DB2 Version 8.2, but it should work on DB2 v9.1 as well.

 

Derby

Command files to define and load the ITSOBANK database in Derby are provided in the folder...

The DerbyCreate.bat, DerbyLoad.bat and DerbyList.bat files assume that you installed Application Developer in...

Edit these files to point to your Application Developer installation directory if you installed the product in a different folder.

After edits, run...

These command files use the SQL statements and helper files provided in:

The Derby ITSOBANK database is created under:

C:\7672code\database\derby\ITSOBANK

 

DB2

DB2 command files to define and load the ITSOBANK database are provided in...

These command files use the SQL statements provided in:

 

Starting the WebSphere Application Server

If you are using a stand-alone WebSphere Application Server v7.0, enter the following commands in a command window:

cd \IBM\WebSphere\AppServer\profiles\AppSrv01\bin startServer.bat server1

If you are using the WebSphere Application Server v7.0 test environment shipped with RAD v7.5, in the Servers view, right-click WebSphere Application Server v7.0 at localhost and select Start.

 

Configure the environment variables

Prior to configuring the data source, ensure that the environment variables are defined for the desired database server type. This step does not apply to Derby because we are using the embedded Derby, which already has the variables defined. For example, if you choose to use DB2 Universal Database, verify the path of the driver for DB2 Universal Database.

Launch the WebSphere administrative console:

If you are using the WebSphere Application Server v7.0 test environment shipped with RAD v7.5, you can simply right-click WebSphere Application Server v7.0 and select...

For a stand-alone server, type the following URL in a Web browser:

You might have to specify a port other than 9062. The administrative console port was chosen during the installation of the server profile.

  1. Click Log in. If you installed WebSphere with administrative security enabled, use the user ID and password chose at installation time (for example, admin/admin).

  2. Expand...

  3. Scroll down the page and click the desired variable and update the path accordingly for your installation.

    For Derby

      DERBY_JDBC_DRIVER_PATH

    By default this variable is already configured because Derby is installed with WebSphere Application Server:

      ${WAS_INSTALL_ROOT}/derby/lib

    For DB2:

      DB2UNIVERSAL_JDBC_DRIVER_PATH

    Edit the value and provide the DB2 installation directory, for example, C:\IBM\SQLLIB\java, or C:\SQLLIB\java.

  4. Click Save (at the top).

 

Configuring J2C authentication data

This section describes how to configure the J2C authentication data (database login and password) for WebSphere Application Server from the WebSphere administrative console. This step is required for DB2 UDB and optional for Derby.

If using DB2 UDB, configure the J2C authentication data (database login and password) for WebSphere Application Server from the Administrative Console:

  1. Select...

  2. Enter the Alias, User ID, and Password in the JAAS J2C Authentication data page. For example, create an alias called db2user with the user ID and password used when installing DB2.

  3. Click Save.

 

Configuring the JDBC provider

This section describes how to configure the JDBC provider for the selected database type. The following procedure demonstrates how to configure the JDBC provider for Derby, with notes on how to do the equivalent for DB2 UDB.

To configure the JDBC provider from the WebSphere administrative console, do these steps:

  1. Select...

      Resources | JDBC | JDBC Providers

  2. Select the server scope from the drop-down menu. In our case, we select...

      Node=<machine>NodeXX, Server=server1

  3. Click New.

  4. From the New JDBC Providers page, do these steps and then click Next:

    Derby...

      Database Type: Derby
      JDBC Provider: Derby JDBC Provider.

    DB2...

      DB2 UDB: DB2
      Implementation type: XA data source
      DB2 UDB: DB2 Universal JDBC Driver Provider

  5. Click Next.

  6. Click Finish.

 

Creating the data source

To create the data source for Derby, do these steps:

  1. Select the Derby JDBC Provider (XA).

  2. Under Additional Properties, select Data sources.

  3. Click New.

  4. Type ITSOBANKderby as Data source name, and jdbc/itsobank as JNDI name. Click Next.

  5. Type C:\7672code\database\derby\ITSOBANK as the Database name. Clear Use this data source in container managed persistence (CMP), because JPA does not use CMP. Click Next.

  6. Skip the Setup security aliases page. Click Next.

  7. Click Finish and then click Save.

  8. Verify the connection by selecting ITSOBANKderby (the check box) and then click Test connection. You should get the message:

      The test connection operation for data source ITSOBANKderby on server server1 at node xxxxxNodexx was successful with 1 warning(s).

If you are using DB2, create a data source for JDBC Providers | DB2 Universal JDBC Provider Driver (XA):

  1. Select...

      Data sources | New

  2. Type ITSOBANKdb2 as Data source name, and jdbc/itsobankdb2 as JNDI name.

  3. Type ITSOBANK as Database name and localhost as Server name. Leave 4 as Driver type and 50000 as Port number. Clear Use this data source in container managed persistence (CMP).

  4. Select the db2user alias for Authentication alias for XA recovery and for Component-managed authentication alias.

  5. Click Next, then Finish and then Save.

  6. Verify the connection by selecting ITSOBANKdb2 (the check box) and then click Test connection. You should get the successful message.

If you always want to use DB2 for the ITSOBANK database, set the JNDI name for the DB2 data source to jdbc/itsobank and for Derby to jdbc/itsobankderby. The sample application uses jdbc/itsobank to access the database, and it can be Derby or DB2.