COM2 is invoked in the same transaction, a separate connection will be acquired. Subsequently, this transaction ties up two connections instead of one.
This reuse of connection feature for COM objects participating in the same transaction is preferable for the following reasons:
It uses fewer resources in both the client and the server. Only one connection is needed.
It eliminates the possibility that two connections participating in the same transaction (accessing the same database server and accessing the same data) can lock one another, because DB2 servers treat different connections from MTS COM objects as separate transactions.
If a small CPTimeout value is used in a high-workload environment where too many physical connects and disconnects occur at the same time, the TCP/IP stack may encounter resource problems.
To alleviate this problem, you should use the TCP/IP Registry Entries. These are described in the Windows NT Resource Guide, Volume 1. The registry key values are located in HKEY_LOCAL_MACHINE-> SYSTEM-> CurrentControlSet-> Services-> TCPIP-> Parameters.
The default values and suggested settings are as follows:
Name |
Default Value |
Suggested Value |
KeepAlive time |
7200000 (2 hours) |
Same |
KeepAlive interval |
1000 (1 second) |
10000 (10 seconds) |
TcpKeepCnt |
120 (2 minutes) |
240 (4 minutes) |
TcpKeepTries |
20 (20 re-tries) |
Same |
TcpMaxConnectAttempts |
3 |
6 |
TcpMaxConnectRetransmission |
3 |
6 |
TcpMaxDataRetransmission |
5 |
8 |
TcpMaxRetransmissionAttempts |
7 |
10 |
If the registry value is not defined, then create it. |
Testing DB2 With The MTS “BANK” Sample Application
You can use the “BANK” sample program that is shipped with MTS to test the setup of the Client Application Enabler products and MTS.
Follow these steps:
1. Change the file \Program Files\Common Files\ODBC\Data Sources\ MTSSamples.dsn so that it looks like this:
2. [ODBC]
3. DRIVER=IBM DB2 ODBC DRIVER
4. UID=your_user_id
5. PWD=your_password
6. DSN=your_database_alias
7. Description=MTS Samples
where:
o your_user_idand your_password are the user-ID and password used to connect to the host.
o your_database_alias is the database alias used to connect to the database server.
8. Go to ODBC Admin in the Control Panel, click on System DSN tab and add the data source:
1. Choose IBM ODBC Driver and click on Finish.
2. When presented with the list of database aliases, choose the one that was specified previously.
3. Click on OK
9. Use DB2 CLP to connect to a DB2 database under the ID your_user_id, as above.
0. Bind the db2cli.lst:
1. db2 bind @C:\sqllib\bnd\db2cli.lst blocking all grant public
2. Bind the utilities.
If the server is a DRDA host server, bind ddcsmvs.lst, ddcs400.lst, or ddcsvm.lst, depending on the host that you are connecting to (OS/390, AS/400, or VSE or VM). For example:
db2 bind @C:\sqllib\bnd\@ddcsmvs.lst blocking all grant public
Otherwise, bind the db2ubind.lst:
db2 bind @C:\sqllib\bnd\@db2ubind.lst blocking all grant public
3. Then create the sample table and data for the MTS sample application as follows:
4. DB2 CREATE TABLE ACCOUNT (ACCOUNTNO INT, BALANCE INT)
5. DB2 INSERT INTO ACCOUNT VALUES(1, 1)
10. On the DB2 client, ensure that the database manager configuration parameter tp_mon_name is set to “MTS”.
11. Run the “BANK” application. Select the Account button and the Visual C++ option, then submit the request. Other options may use SQL that is specific to SQL Server, and may not work.
以下文章点击率最高
Loading…