Hitachi

uCosminexus Application Server System Setup and Operation Guide


4.1.8 Setting the database connection environment (Setting SQL Server)

Use DB Connector as the resource adapter to connect to a database from a J2EE application. Also, to connect to a database by using DB Connector, you need a JDBC driver that supports the database.

This subsection describes the settings for the database connection environment required for connecting to SQL Server by using DB Connector. Use the JDBC driver for SQL Server as the JDBC driver. Implement these settings on the host to which the J2EE server is allocated.

For the notes on setting up a database, see 4.1.9 Notes on setting up a database.

Organization of this subsection

(1) Database settings

When using a DB Connector to connect to SQL Server, install SQL Server on the database machine and complete the initial settings. For details, see the SQL Server documentation. You must also set the authentication mode to connect to SQL Server. You specify the authentication mode during installation, but you can change this mode even after the installation.

The authentication mode of SQL Server that can be specified in Application Server is classified into two types, mixed mode and Windows authentication mode, depending on the authentication method that can be set by you. This section describes the authentication mode and authentication method for each type.

Authentication mode
  • Mixed mode

    An authentication mode that can use both Windows authentication and SQL Server authentication methods

  • Windows authentication mode

    An authentication mode that can use Windows authentication

Authentication methods
  • Windows authentication

    This is one of the mechanisms for verifying the trial connection to the SQL Server. While connecting, the user is identified based on the Windows user or the group.

  • SQL Server authentication

    This is one of the mechanisms for verifying the trial connection to SQL Server. To connect, you must specify the login ID and password of SQL Server. First, check that the combination of the login ID and password specified by you in the instance of SQL Server is valid, and then connect.

(2) J2EE server settings (for SQL Server JDBC Driver)

Acquire the JAR file of the SQL Server JDBC Driver of the version supported by Application Server, and then specify the class path of the J2EE server. This section describes how to acquire the JAR file and specify the class path.

  1. Download the SQL Server JDBC Driver Version number supported by Application Server from the Microsoft company homepage.

  2. Install the downloaded SQL Server JDBC Driver on the machine that operates the J2EE server.

  3. Specify the JAR file in the user class path of the J2EE server.

    The specified JAR file is the JAR file of the JDBC driver, under the SQL-Server-JDBC-Driver-installation-directory\sqljdbc_version\<language> directory.

    In the Easy Setup definition file, add the settings of JAR file in the configuration tag with the definition of the J2EE server of the physical tier definition (definition of the tier tag). For specifications, see 4.3 Easy Setup definition file in uCosminexus Application Server Definition Reference Guide.

    <?xml version="1.0" encoding="UTF-8"?>
    <model-definition xmlns="http://www.cosminexus.com/mngsvr/schema/ModelDefinition-2.5">
      <!-- Web system attribute definition -->
      <web-system>
        <name>MyWebSystem</name>
          :
        <!-- physical tier (combined-tier) definition -->
        <tier>
          <tier-type>combined-tier</tier-type>
          <!-- Setting for using SQL server -->
          <configuration>
            <logical-server-type>j2ee-server</logical-server-type>
            <param>
              <param-name>add.class.path</param-name>
              <param-value>Specify-path-of-JAR-file-for-SQL-Server-JDBC-Driver</param-value>
          <!-- Setting for using Windows authentication -->
              <param-name>add.library.path</param-name>
              <param-value>Specify-path-of-directory-storing-dll-file-for-SQL-Server-JDBC-Driver</param-value>
            </param>
          </configuration>
        </tier>
          :
      </web-system>
      <host>
        :
    </model-definition>

    Note: The part that is bold and highlighted is the part to be edited.

    When using the Windows authentication, you must execute the following settings in addition to the JAR file settings.

    This section describes the settings required when using the Windows authentication.

  4. Specify the directory that contains the dll file stored in the search path of the library for JNI of the container extension library of the J2EE server.

    The directory to be specified is SQL-Server-JDBC-Drive-installation-directory\sqljdbc_version\language\auth\x64 directory.

  5. Import the DB Connector for SQL Server in the J2EE Server (DBConnector_SQLServer_CP.rar).

    For details on DB Connector see 3.6 Connecting to the database in the uCosminexus Application Server Common Container Functionality Guide.

    Import DBConnector_SQLServer_CP.rar by using the cjimportres command.

(3) Timeout settings

Set the timeout of SQL Server as and when required. For details on the timeout settings, see 8.6.6 Setting the database timeout in the uCosminexus Application Server System Design Guide.