Sun Adapter for TCP/IP HL7 User's Guide

Creating and Configuring the MLLP V2.0 Database

Using the HL7 Adapter with MLLP V2.0 transport scenarios requires an MLLP database. This topic describes the steps to connect to Sun's Java Database (based on the Apache Derby database) and run the MLLP V2.0 database scripts.

The TCP/IP HL7 Adapter supports the following database platforms for the MLLP database:

Perform the following steps in the order given to set up the MLLP database:

ProcedureTo Create and Connect to the Database

  1. Create a database instance using your database platform tools. If you are using a Java DB database, perform the following steps to create the database:

    1. On the NetBeans Services window, expand Databases.

    2. Right-click Java DB, and then click Create Database.

      The Create Java DB Database dialog box appears.

    3. Enter a name for the database, along with a login user name and password.

    4. Click OK.

      The database appears in the list of databases on the Services window.

  2. Make sure your database instance is running.

  3. For Oracle, DB2, SQL Server, and Sybase databases, do the following:

    1. Copy the database driver file to JavaCAPS_Home/appserver/lib.

    2. Under Databases on the NetBeans Services window, right-click Drivers and then select New Driver.

      The New JDBC Driver dialog box appears.

    3. Click Add, and then brows to and select the database driver file.

    4. Select or look for the driver class to use.

    5. Accept the default name or enter a name for the driver.

    6. Click OK.

    7. In the Drivers list on the Services window, right-click the driver you just added and click Connect Using.

      The New Database Connection dialog box appears.

    8. Enter the connection information for the database instance you created for MLLP and then click OK.

      The new database connection appears in the Databases list.

  4. On the NetBeans Services window, right-click the MLLP database, and click Connect.

    NetBeans connects to the database and the icon changes for that database. The following figure illustrates a Java DB connection.

    Derby Database
    Note –

    A broken icon represents that the database is not connected.


ProcedureTo Run the MLLP V2.0 Database Scripts

You can either run the MLLP database scripts from NetBeans or from a SQL editor. The following steps take you through running the scripts from NetBeans.

  1. On the NetBeans IDE, click the Projects tab.

  2. Expand CAPS Components Library > Adapters > HL7 > Database Scripts.

  3. Right-click db_platform_install.sql; for example, derby_install.sql.

  4. Click Open.

    Figure shows the HL7 Message Library structure
in the Projects window.

    This opens the SQL Editor window along with the SQL Statement.


    CREATE TABLE HL7MESSAGELOG (MESSAGEID VARCHAR(250), APPLICATIONID VARCHAR(250) ,
    REQUESTMESSAGE CLOB, RESPONSEMESSAGE CLOB, STATUS SMALLINT, CREATEDTIME TIMESTAMP,
    LASTUPDATEDTIME TIMESTAMP) 
  5. In the SQL Editor toolbar, click in the Connection field and select the database connection from the drop-down list.

  6. In the toolbar, click Run SQL.

    A message appears in the Output panel indicating whether the script was run successfully.

  7. To view the new tables, return to the Services window, right-click the database connection, and then click Refresh. Expand the database connection and then Tables to view the database.

ProcedureTo Create the Connection Pool and JDBC Resource

In order to connect to the database, you need to define a JDBC connection pool and JDBC resource using the GlassFish Admin Console or the command-line interface.

  1. Start the GlassFish server.

  2. To create the connection pool and JDBC resource, follow the instructions under Creating a JDBC Connection Pool in Sun GlassFish Enterprise Server 2.1 Administration Guide.

    Use the information from the database connection you created earlier in To Create and Connect to the Database.

ProcedureAssociating the MLLP Database With the Adapter

Once you create the MLLP database, you can connect to it from the inbound TCP/IP HL7 Adapter. You do this in the HL7 External Systems properties located in the CAPS Environment you create for the HL7 Project. This procedure assumes you have already created the Environment and that it includes an HL7 External System.

  1. On the NetBeans Services window, expand CAPS Environments, and then expand the HL7 Environment you created for your Project.

  2. Right-click the HL7 External System, and select Properties.

    The Properties Editor appears.

  3. In the left pane, expand HL7 Inbound eWay.

  4. Select Database Settings.

  5. In the JNDI Name of the JDBC Datasource property, enter the JNDI name of the JDBC Resource you created under To Create the Connection Pool and JDBC Resource.

  6. Click OK.