NexJ Logo

Creating data source connections

Once you have specified an application server, you can add data source connections to the environment file.

A data source is a logical representation of physical storage. It uses a CRUD (Create, Read, Update, and Delete) interface to interact with data objects in the physical storage. Data sources are configured and bound to physical storage addresses through connections. The following data source connections are available:

File Storage Connection
Allows you to work with persisted instances of data in a file system.

Relational Database Connection
Allows you to work with persisted instances of data in a relational database. Refer to the Release Notes document for a list of supported relational databases.

Service Data Source Connection
Allows you to work with persisted instances of data using a collection of services, such as web services and stored procedures. The process to create a service data source connection differs from that of other connection types. Refer to Configuring a service data source connection for instructions on how to create this connection.

XML Connection
Allows you to work with persisted instances of data in an XML file.

Data source connections can be added to an environment in any order. The number of connections that can be added is limited only by the number of available data sources. Refer to the NexJ Framework Metadata Reference for detailed information on the elements and attributes of data source connections.

Creating a data source connection

You can create a data source connection from NexJ Studio.

To create a new data source connection:

  1. Open the environment to which you want to add a data source connection.
    The environment opens in the editor window.
  2. In the editor window, click the Data Source Connections tab.
  3. In the Data Source Connections area, click the Add button  and select the type of database connection that you want to create.

The data source connection that you selected is now listed in the Data Source Connections area. When you select a data source connection from the list, its configuration options are displayed underneath.

Required data source connections

The following data sources are required for a deployment of NexJ CRM.

  • AuditLogDatabase
  • BI_1_BI_Database
  • call:Call
  • Conversation
  • DefaultRelationalDatabase
  • ecr:ECR
  • flow:Flow
  • LockDatabase
  • msg:Messaging
  • ObjectQueueDatabase
  • rules:Rules
  • SessionDatabase
  • sso:SSO
  • StagingDatabase
  • StatDatabase
  • uicomp:UIComponent

Upgrading data sources for version 8.9

Configuring data source connections

Before you configure specific settings for a data source connection, select a data source adapter.

Data source adapters are used to present a common, or shared, communication interface between your system and the external data source. An adapter must be set for each data source connection.

To select an adapter for a data source connection in NexJ Studio:

  1. Open the environment that you want to edit and click the Data Source Connections tab.
  2. In the Data Source Connections area, select the data source connection that you want to configure.
    Configuration options for the chosen connection are displayed underneath.
  3. In the Adapter field, click the Select button .
    The Select Adapter window opens.
  4. Select the type of database adapter to use with the connection and click OK.
    The Select Adapter window closes.
  5. Click the Save button  in the toolbar to save the changes to the connection.

    Info

    The procedure to configure an adapter for a service data source connection differs from that of other connection types. Refer to Configuring a service data source connection for instructions on how to configure this connection.

Once you have specified the data source adapter, configure the rest of the available settings for the selected data source connection.

For a list of required data sources and sample configurations for NexJ CRM, see Example environment settings for NexJ CRM deployment.

Configuring a file storage connection

To use a file storage connection, you must at minimum specify a data directory and temporary directory.

To configure a file storage connection in NexJ Studio:

  1. Open the environment that you want to edit and click the Data Source Connections tab.
  2. In the Data Source Connections area of your environment, select the FileStorageConnection that you want to configure.
    Configuration options for the chosen connection are displayed underneath.
  3. In the Data Directory field, enter a path that points to the root of the directory tree on the server where files are stored.
  4. In the Temporary Directory field, enter a path that points to the directory on the server where files are prepared.
  5. Click the Save button  in the toolbar to save the changes to the connection.

Example

For example, to configure a connection to use a generic file storage data source:

  1. Open the environment that you want to edit and click the Data Source Connections tab.
  2. In the Data Source Connections area, click the Add button  and select File Storage Connection.
  3. In the General tab, click the Select button  in the Adapter field. The Select Adapter window opens.
  4. Select Generic from the list, then click OK. The Select Adapter window closes.
  5. In the Data Directory field, enter C:\Path\to\Data\Folder.
  6. In the Temporary Directory field, enter C:\Path\to\Temporary\Folder.
  7. In the Description field, enter File Persistence Adapter.
  8. Click the Save button  in the toolbar to save the changes to the environment.

These changes are reflected in the environment file XML as follows:

<Environment ...> 
   <DataSourceConnections> 
      <FileStorageConnection adapter="Generic" dataDirectory="C:\Path\to\Data 
\Folder" dataSource="FileStorageDataSource" description="File Persistence 
Adapter" temporaryDirectory="C:\Path\to\Temporary\Folder"/> 
   </DataSourceConnections> 
</Environment>


Configuring a relational database connection

To use a relational database connection, you must at minimum specify the adapter, database name, host, port, user ID, and password.

If you are configuring your environment for an IBM WebSphere application server, you must also specify a path to the JAR file for the JDBC driver.

To configure a relational database connection in NexJ Studio:

  1. Open the environment that you want to edit and click the Data Source Connections tab.
  2. In the Data Source Connections area of your environment, select the RelationalDatabaseConnection that you want to configure.
    Configuration options for the chosen connection are displayed underneath.
  3. In the Host field, enter the host name of the database server.
  4. In the Port field, enter the port number of the database server.
  5. In the Database field, enter the name of the database to which the connection is made.
  6. In the User and Password fields, enter the user name and password used to connect to the database.
  7. If you are using a WebSphere server, click the Advanced tab. In the Path field, enter the name of the JAR file for the JDBC driver. If there are multiple JAR files, separate each with a comma.
  8. Click the Save button  in the toolbar to save the changes to the connection.

Example

For example, to configure a connection for use with a typical DefaultRelationalDatabase data source:

  1. Open the environment that you want to edit and click the Data Source Connections tab.
  2. In the Data Source Connections area, click the Add button  and select Relational Database Connection.
  3. In the General tab, click the Select button  in the Adapter field.
    The Select Adapter dialog opens.
  4. Select MSSQL from the list, then click OK.
    The Select Adapter dialog closes.
  5. In the Host field, enter localhost.
  6. In the Port field, enter 1433.
  7. In the Database field, enter enterprise.
  8. In both the User field and the Password field, enter nexj.
  9. Click the Advanced tab. In the Path field, enter jtds-1.2.2-7.jar.
  10. Click the Save button  in the toolbar to save the changes to the environment.

These changes are reflected in the environment file XML as follows:

<Environment ...> 
   <DataSourceConnections> 
      <RelationalDatabaseConnection adapter="MSSQL" dataSource= "DefaultRelationalDatabase" 
database="enterprise" host="localhost" password= "text:nexj" 
path="jtds-1.2.2-7.jar" port="1433" user="nexj"/> 
   </DataSourceConnections>
</Environment>

Configuring a service data source connection

You only need to specify an adapter type to be able to use a service data source connection.

The connection receives the rest of its configuration from the data source. The data source is configured in the Persistence layer of NexJ Studio.

To configure a service data source connection in NexJ Studio:

  1. Open the environment that you want to edit and click the Data Source Connections tab.
  2. In the Data Source Connections area of your environment, select the Service Data Source Connection that you want to configure. Configuration options for the chosen connection are displayed underneath.
  3. In the Adapter field, click the Select button .
    The Select Adapter dialog opens.
  4. Select the adapter that you want to use for the Service Data Source Connection, then click OK.
    The Select Adapter dialog closes.
  5. Click the Save button  in the toolbar to save the changes to the connection.

Example

For example, to configure a connection for use with a typical Service Data Source Connection:

  1. In the Persistence layer, ensure that there is a service data source channel in the Channels tab.
  2. Open the environment that you want to edit and click the Data Source Connections tab.
  3. In the Data Source Connections area, click the Add button  and select Service Data Source Connection.
  4. In the General tab, click the Select button  in the Adapter field. The Select Adapter dialog opens.
  5. Select Generic from the list, then click OK. The Select Adapter dialog closes.
  6. Click the Save button  in the toolbar to save the changes to the environment.

These changes are reflected in the environment file XML as follows:

<Environment ...>
   <DataSourceConnections> 
      <ServiceDataSourceConnection> 
         <Properties> 
            <Property name="adapter" value="Generic"/> 
         </Properties> 
      </ServiceDataSourceConnection> 
   </DataSourceConnections> 
</Environment>

Configuring an XML connection

To use an XML connection, only an adapter type must be specified.

Refer to Configuring data source connections for instructions on how to set a data source adapter.

Example

For example, to configure a connection to use a generic XML data source:

  1. Open the environment that you want to edit and click the Data Source Connections tab.
  2. In the Data Source Connections area, click the Add button  and select XML Connection.
  3. In the General tab, click the Select button  in the Adapter field.
    The Select Adapter dialog opens.
  4. Select Generic from the list, then click OK.
    The Select Adapter dialog closes.
  5. In the Path field, enter C:\Path\to\XML\Connection\...\meta.
  6. Click the Save button  in the toolbar to save the changes to the environment.

These changes are reflected in the environment file XML as follows:

<Environment ...> 
   <DataSourceConnections> 
      <XMLConnection adapter="Generic" dataSource="XMLDataSource" path="C:\Path \to\XML\Connection\...\meta"/> 
   </DataSourceConnections> 
</Environment>