Running an MTS Application


It's pretty easy to run an MTS application. You will execute the Sample Banking MTS Application supplied with MTS on the NT Server Option Pack. Several prerequisites are necessary before this sample application can run successfully:

  1. Use 32-bit ODBC to create a System DSN named MTSSamples. This DSN will point to the Pubs database in SQL Server 2000. Figure 43.11 shows the ODBC DSN dialog box needed for this MTS example.

    Figure 43.11. Configuring ODBC DSN entry: MTS Samples.

    graphics/43fig11.jpg

  2. You should install the Sample Bank.PAK file under MTS control as described in the section "Installing an MTS Component" earlier in this chapter.

  3. You should configure security for the Sample Bank package components as described in the section "Configuring Security" earlier in this chapter.

  4. In SQL Server, set Authentication to SQL Server and Windows NT. Now, ensure that SQL Server 2000 is running. Figure 43.12 shows a valid NT user /domain login for SQL Server (Windows Authentication).

    Figure 43.12. The Enterprise Manager: Server Logins.

    graphics/43fig12.jpg

  5. Ensure that DTC is running. Figure 43.13 shows both MS DTC and MS SQL services running.

    Figure 43.13. MS DTC and SQL Server running.

    graphics/43fig13.jpg

NOTE

All examples illustrated here were run on a Windows NT Server 4.0 platform.

Everything appears to be ready to execute the Sample Banking MTS application.

Executing Sample Banking

This test application can be started via the program item entry in the MTS program group named Bank Client or by directly executing the Bank Client located in C:\Program Files\Mts\vbbank.exe from Windows Explorer. After Bank Client is started, it should display the Sample Bank screen from which you can submit transactions (Figure 43.14).

Figure 43.14. Bank Client MTS application.

graphics/43fig14.jpg

I entered a transaction request that would execute the Account Component and issue a credit transaction. Before I submitted this request, I brought up the MTS Explorer and displayed the Transaction Statistics option. I observed the number of active and aggregated transactions processed by MS DTC and expected to see more committed transactions after I executed the request. Figure 43.15 shows the aggregated MS DTC transaction picture after I executed the request and others.

Figure 43.15. MTS Explorer: Transaction statistics.

graphics/43fig15.jpg

Troubleshooting

MTS is likely to be in a middle tier in an n -tier system, and complex interactions might take place between the MTS software and the software in other tiers.

Table 43.2 lists some of the errors you might encounter when running any MTS application. You will probably see these types of errors in your own system fairly soon after starting to use MTS.

Table 43.2. Common Errors in MTS Applications
Error Message Meaning
429 ActiveX component can't create object The MTS component you are trying to use has not been installed correctly. See the section "Installing an MTS Component" earlier in this chapter.
70 Permission Denied You don't have permission to use the methods of the MTS component. Did you remember to shut down the package after changing MTS permissions?
13 Type Mismatch Your application could not pull results from the database. Check the database configuration. Do you have a proper ODBC System DSN entry and the necessary permissions?

Play with the permissions and configurations in both MTS and SQL Server to see how to cause and fix all these types of errors. This exercise will more clearly reveal the relationship between SQL Server 2000 and MTS.

In general, if you are starting to have trouble with transactions under MTS, verify the following:

  • Make sure that MS DTC is up and running on all servers.

  • Check network communication by first testing on a local computer to verify that the application works.

  • Use ping to verify that each machine is reachable .

  • Make sure that SQL Server and MS DTC are either located on the same computer or that the DTC Client Configuration program specifies that the DTC is on another computer. If not, SQLConnect will return an error when called from a transactional component.

  • Make sure your ODBC drivers are thread-safe and do not have thread affinity.

  • Set the MTS Transaction timeout to a higher number than the default 60 seconds; otherwise , MTS aborts the transaction after this time has passed.

  • Perhaps turn off resource pooling (a registry key flag).

  • You might have to resolve MTS transactions manually via the Transaction list window of the MTS Explorer. Understand where the failure might be and then force (commit manually) the transaction. You might have to look at each MS DTC involved in the request.



Microsoft SQL Server 2000 Unleashed
Microsoft SQL Server 2000 Unleashed (2nd Edition)
ISBN: 0672324679
EAN: 2147483647
Year: 2002
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net