This subsection describes the preconditions and notes on connecting to SQL Server.
The preconditions for SQL Server are as follows:
Table 3-30 Transaction support levels available for each RAR file (SQL Server)
Used DB Connector (RAR file) | Transaction support level | Light transaction | |
---|---|---|---|
Enabled | Disabled | ||
DBConnector_SQLServer_CP.rar | NoTransaction LocalTransaction | Y | Y |
Note that you can only connect to SQL Server in Windows.
This subsection describes the notes related to the character code conversion in the system and the notes on the DB Connector settings when you connect to SQL Server.
When you are connected to SQL Server and want to store data containing a Japanese character code in the database, you must take into account the character code conversion in the system. This section gives an overview of the character code conversion in a system, and describes the notes on specifying the settings to avoid garbled characters.
With Java, the Japanese character code is expressed using Unicode. When you use SQL Server, the character code conversion is implemented during the processing between the Web client and Application Server and between Application Server and SQL Server.
The following figure gives an overview of the character code conversion when SQL Server is used.
Figure 3-19 Overview of the character code conversion when SQL Server is used
A description of points 1 to 4 in the figure is as follows:
When you use SQL Server, problems such as garbled characters might occur depending on the combination of the external character code and database storage character code, and the types of converter used for implementing the character code conversion. To avoid garbling, you must note the character code settings.
SQL Server supports the character data types described in the following table. When you use SQL Server, you can prevent the occurrence of garbling during the character code conversion by using the Unicode data types.
Table 3-31 Character data types supported by SQL Server
Category | Character data type |
---|---|
Unicode data types | nchar, nvarchar, ntext |
Non-Unicode character data types | char, varchar, text |
The following paragraphs describe the character code conversion when you use the Unicode data types and when you use the non-Unicode data types as the database storage character code in SQL Server:
The following table describes the notes on specifying direct in the value of the selectMethod property (item name of <config-property-name>) of DB Connector.
Table 3-32 Notes on specifying the selectMethod property of DB Connector
Condition | Notes |
---|---|
The connection error detection functionality is enabled | A connection error that occurs might be misdiagnosed as normal. As a result, the connection with an error might be returned to the user application program, so do not use the connection error detection functionality. When an error is detected, execute the cjclearpool command. |
Multiple Statement, PreparedStatement and CallableStatement are generated concurrently | The JDBC driver for SQL Server generates a connection to SQL Server for each concurrently generated statement. Also, note that when the statement pooling functionality is used, connections are generated for each pooled statement, and a large amount of memory is consumed. |
Make sure you use the connection pooling functionality to connect to SQL Server 2005.
The following events might occur depending on the behavior of SQL Server JDBC Driver 3.0:
The database sessions are not disconnected and the un-used sessions are left behind until garbage collection occurs. To avoid this event, execute the javagc command.
Note that this event occurs in the following conditions:
When the number of database sessions reaches the maximum concurrent user connections for the database because the above-mentioned (a) database sessions are not disconnected, you can no longer generate new sessions. When you execute the getConnection method of the javax.sql.DataSource interface from the user program, java.sql.SQLException might occur. To avoid this event, specify 0 (unlimited) as the maximum concurrent user connections for the database.
Note that this event occurs when 1 or more is specified as the maximum concurrent user connections for the database.
The notes on connecting to SQL Server 2008 or SQL Server 2012 are as follows. Note that none of the precautions on using SQL Server 2005 are applicable.