ID: Q193893
The information in this article applies to:
- Microsoft Transaction Server 2.0
This article describes how to use Oracle databases with Microsoft Transaction Server (MTS).
This information entirely replaces earlier documentation that described how to use Oracle with Microsoft Transaction Server (MTS) including the documentation that accompanied the Microsoft Transaction Server 2.0 release.
Microsoft Transaction Server components can access both Oracle 7 and Oracle 8 database servers. MTS components may access Oracle database servers on Windows NT, Unix, and other systems. MTS components can also access Oracle Workgroup Servers, Oracle Enterprise Servers, and Oracle Parallel Servers.
The following software is required to access an Oracle database from MTS components.
Oracle 7.3
Component Version
Oracle Server on Windows NT 7.3.3.5.2 or later
Oracle SQL*Net 2.3.3.0.4 or later
Oracle Ociw32.dll 1.0.0.5 or later
Oracle Sqllib18.dll 1.8.3.0.4 or later
Oracle Xa73.dll 7.3.3.5.2 or later
Oracle Server on UNIX 7.3.3 with patches
Oracle 8
Component Version
Oracle Server on Windows NT 8.0.4.1.1c or later
Oracle Net8
Oracle Ociw32.dll 8.0.4.0.0 or later
Oracle Sqllib80.dll 8.0.4.1.0 or later
Oracle Xa80.dll 8.0.4.1.0 or later
Oracle Server on UNIX 8.0 or later
Microsoft Transaction Server 2.0 2.0 or later
Microsoft ODBC Driver for
Oracle (Msorcl32.dll) 02.73.7283.3 or later
ActiveX Data Objects (ADO)*
(Msado15.dll) 1.50.2.2404 (MDAC 1.5c) or later
NOTE: Earlier versions of the software may not work properly. We strongly
suggest that you install the most recent patch release available from
Oracle. The Oracle software versions in the preceding list are the minimum
versions required, but please use the most recent version of Oracle
software available. Failing to do this is by far the most common source of
problems when trying to use Microsoft Transaction Server with Oracle.
Your transactional Microsoft Transaction Server components may access an Oracle 7.3.3 or later database server on Windows NT. You can use either the Oracle 7.3.3 Workgroup Server release for Windows NT or the Oracle 7.3.3 Enterprise Server release for Windows NT.
We do not recommend using Oracle 7.3.2 or earlier versions of Oracle with Microsoft Transaction Server. Oracle first supported XA transactions on Windows NT in the Oracle 7.3.3 release; therefore, you cannot use Oracle 7.3.2 or earlier releases when transactions require Microsoft Transaction Server. In the Oracle 7.3.3.5.0 and higher releases Oracle works much more reliably on multiprocessor computers and in highly multi-threaded applications such as Internet Information Server (IIS) or Microsoft Transaction Server.
Your transactional Microsoft Transaction Server components can access an Oracle 8 database server on Windows NT.
Your transactional Microsoft Transaction Server components can access an Oracle 7.3 database server on Unix.
You must install the Oracle 7.3.3 release (or later) for that UNIX platform. In most cases, you also must install an Oracle 7.3.3 patch release for Oracle on UNIX.
Check with the Oracle Customer Support to determine if an Oracle 7.3.3 patch release is required for your UNIX platform. Explain that you are going to access your Oracle database on UNIX using the XA transaction support that is included in the Oracle 7.3.3 release on Windows NT.
Your transactional Microsoft Transaction Server components can access an Oracle 8 database server on Unix.
Your transactional Microsoft Transaction Server components can access an Oracle 7.3 or Oracle 8 database using either Oracle 7.3 or Oracle 8 Client software.
By default, Microsoft Transaction Server is configured to use Oracle 7.3 Client Software. For more information on configuring Microsoft Transaction Server to use Oracle 8 Client software, please see the "Setting Up Oracle Support" section in this article.
Support is now available for Oracle database connectivity with Microsoft Transaction Server components running on the Digital Alpha platform. At present, Microsoft Transaction Server clients can only access an Oracle database using Oracle 7.3 Client software.
Currently, the Microsoft Oracle ODBC driver, Msorcl.dll will not work with the Digital Alpha Oracle 8 Client software. This Microsoft Oracle ODBC driver problem should be corrected in a future release.
When you use Oracle 7.3 Client software, you must install the Oracle Ociw32.dll file designed to work with the Oracle 7.3 release. This .dll file can be found in the \Win32\V7\Rsf73 directory of the Oracle 7.3 CD- ROM.
Oracle also includes an older version of the Ociw32.dll file on the Oracle 7.3 CD-ROM that is designed to work with the Oracle 7.2 release. This .dll file is located in the \Win32\V7\Rsf72 directory. This .dll does not work with Microsoft Transaction Server.
The following version of the Oracle Ociw32.dll file is provided in the \Win32\V7\Rsf72 directory and fails when used with Microsoft Transaction Server:
Version: 7.x
Date: Thursday, February 01, 1996 12:50:06 AM
Size: 36 KB
You must install Microsoft Transaction Server 2.0 or later if you want to access an Oracle database using Microsoft Transaction Server under transaction control.
The Microsoft ODBC Driver 2.0 for Oracle (Msorcl32.dll) version 02.73.7283.3 or later is required if you want to use Microsoft Transaction Server transactions. The Windows NT 4.0 Option Pack program automatically installs this .dll file.
If you want to access an Oracle database, we strongly suggest that you use the new Microsoft Oracle ODBC Driver 2.0 even if you do not require transaction support. This new driver offers better performance than the Oracle 1.0 driver does it replaced. The Oracle 1.0 driver serialized all activity at the driver level; requests were single-threaded through the driver. The Oracle 2.0 driver serializes all activities at the connection level. This allows you to use different database connections in parallel.
If your application uses ADO, we strongly suggest that you install either the Microsoft Data Access Components 1.5c release or the Microsoft Data Access Components 2.0 release. You can obtain either of these releases from the following Web site by following the "Download" link to the "Universal Data Access Downloads" section:
http://www.microsoft.com/data/
To prepare Oracle to work with the transactional Microsoft Transaction Server component, please use the following steps:
1. Install the Oracle Database Server software.
Install the appropriate Oracle software on your database server system
as described in the preceding section.
2. Install the Oracle Client software.
Install the latest Oracle 7.3 or Oracle 8 client software on your
Microsoft Transaction Server system.
If you are using Oracle 7.3 Client software, make sure that the correct
version of the Oracle Ociw32.dll is installed as described in the
Required Software section.
3. Install Microsoft Transaction Server 2.0.
When you install Microsoft Transaction Server 2.0, the following
software is installed:
- Microsoft Transaction Server 2.0, including the Microsoft OCI
Interface
- Microsoft ODBC 3.5 Driver Manager
- Microsoft ODBC Driver for Oracle 2.0
- ADO 1.5
4. Install Microsoft Data Access Components version 2.0.
You can install the Microsoft Data Access Components 2.0 release from
the following Web URL by following the "Download" link to the
Universal Data Access Downloads section:
http://www.microsoft.com/data/
5. Update the Oracle Client Software Registry Keys.
NOTE: If you are using the Oracle 7.3 Client software, you can skip
this step.
If you are using the Oracle 8 Client software, you must modify the
values of two registry keys. Under the following registry key are two
string-named values that specify the names of the Oracle 7.3 Client
software .dlls:
HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Transaction
Server\Local Computer\My Computer
String-Named Values:
OracleXaLib "xa73.dll"
OracleSqlLib "sqllib18.dll"
Change these values to specify the names of the Oracle 8 Client
software .dlls:
OracleXaLib "xa80.dll"
OracleSqlLib "sqllib80.dll"
6. Delete the Dtcxatm.log file.
If you have never installed the Microsoft Transaction Server 2.0 Beta
release, skip this step.
If you previously installed the Microsoft Transaction Server 2.0 Beta
release, use Windows Explorer to determine if the Dtcxatm.log file is
present on your system. If so, stop the Microsoft DTC service and delete
the Dtcxatm.log file.
You should only delete the Dtcxatm.log file once when you first upgrade
from the Microsoft Transaction Server 2.0 Beta release. You should never
delete the Dtcxatm.log file thereafter, because it may contain vital
recovery information.
7. Enable Oracle XA Transaction Support.
Perform the following steps to enable Oracle XA transaction support:
a. The Oracle system administrator must create views known as
V$XATRANS$. To do this, the administrator must run an Oracle-
supplied script, named Xaview.sql. This file can be found in the
following directory:
C:\ORANT\RDBMS73\ADMIN
b. The Oracle system administrator must grant SELECT access to the
public on these views. For example:
Grant Select on V$XATRANS$ to public
c. In the Oracle Instance Manager, from the View menu, click
"Advanced Mode" and then select "Initialization Parameters" in the
left pane. In the right pane, select "Advanced Tuning" and
increase the "distributed_transactions" parameter to allow more
concurrent MTS transactions to update the database at a single
time.
Consult your Oracle Server documentation for more information
about configuring Oracle XA transaction support.
8. Configure Integrated Security.
Integrated security allows an Oracle database to rely upon Windows NT
authentication to validate database users. This permits a user to log in
to Oracle without supplying a separate login ID or password. Users can
maintain one login ID and password for both Windows NT and Oracle.
If your Microsoft Transaction Server components always supply a login ID
and password when connecting to Oracle databases, then you are not using
integrated security. This is true whether your applications specify the
login ID and password directly or indirectly through a data source name
(DSN). In either event, you are not using integrated security and can
ignore this step.
If you use integrated security, you must configure Microsoft Distributed
Transaction Coordinator to run under a login ID and password authorized
to connect to your Oracle database. This is required because during
database recovery, Microsoft Distributed Transaction Coordinator opens
your Oracle database to tell it the outcome of in doubt transactions.
You can configure the login ID for the Microsoft Distributed Transaction
Coordinator as follows. From the Start menu, choose Settings and then
select Control Panel. Start the Services applet on the control panel.
Double click MSDTC. Select "Log On As" and specify a login ID and
password. Use the Oracle security administration tools to make sure that
the login ID you specify is authorized to open your Oracle database.
For more information on Oracle’s integrated Windows NT security
facilities, consult your Oracle documentation.
9. Configure Oracle Multi-Threaded Server Support.
You must configure the Oracle "Multi-Threaded Server" feature if you
want to open a database link to a remote Oracle database. This is
essential because when using XA transaction support, the Oracle database
must be able to move the XA transaction between processes (in the
general case) so it cannot have any operating system file descriptors
open but rather it must connect to the remote database using a virtual
circuit. Support for Virtual circuits is available only with Oracle
"Multi-Threaded Server".
If the Oracle "Multi-Threaded Server" feature is not configured
properly, Oracle reports the following error:
ORA-24777: Cannot create migratable transaction
NOTE: Oracle refers to the "Multi-Threaded Server" feature using the
acronym "MTS". Microsoft refers to "Microsoft Transaction Server" using the
acronym "MTS". The only relation between these two terms is the one
described in the preceding section. We apologize for the confusion.
10. Configure Oracle to support more connections.
If you want to create more than a few dozen connections to an Oracle
database, you must configure the Oracle server to support additional
database connections. Please see the "Configuring Oracle to Support a
Large Number of Connections" section for more information.
After installing and configuring Oracle support, you must validate your Oracle installation using the Oracle test program installed with MTS. The Oracle test program uses Oracle's OCI XA interfaces in much the same way that MTS uses them. The Oracle 7 version of the test program is installed when you install Microsoft Transaction Server. The source code for the Oracle 8 version of the test program is included in this article. You must compile this source code using the C++ compiler to produce the TestOracleXaConfig.exe program for Oracle 8.
The Oracle test program determines whether you can connect to an Oracle database using Oracle's XA facility. The Oracle test program uses standard Oracle interfaces and transaction facilities. It makes no use of Microsoft Transaction Server or Microsoft Distributed Transaction Coordinator. Therefore, failure of the test program indicates an improper installation or configuration of your Oracle system. If the Oracle test program fails, reinstall and reconfigure Oracle, or contact the Oracle Support Organization for assistance.
To run the Oracle test program follow these steps:
1. Verify that you have installed all of the correct versions of the
software as described in the Required Software section.
2. Create an ODBC DSN that refers to your Oracle database. Make sure that
your DSN uses the new Microsoft Oracle ODBC 2.0 driver.
3. Ensure that you have enabled Oracle XA support.
4. Delete all existing Oracle trace files from the computer containing the
MTS components that access the Oracle database. The easiest way to do
this is to use the Windows Explorer to locate and delete all *.trc
files.
If the Oracle test program fails, the trace files may help you determine
the source of the problem. By deleting all obsolete trace files, you
make it easier to find any newly created ones.
5. If you previously installed the Microsoft Transaction Server 2.0 beta
release, use the Windows Explorer to determine if the Dtcxatm.log file
is present on your system. If so, stop the Microsoft DTC service and
delete the Dtcxatm.log file.
NOTE: If you never installed the Microsoft Transaction Server 2.0 beta
release, you can skip this step.
You should only delete the Dtcxatm.log file once when you first upgrade
from the Microsoft Transaction Server 2.0 beta release. You should never
delete the Dtcxatm.log file thereafter, because it may contain vital
recovery information.
6. From the MS-DOS Command prompt run the Oracle test program,
TestOracleXaConfig.exe, and supply your Oracle server user ID, password,
and service_name. For example:
c:>TestOracleXaConfig.exe -U<user id> -P<Password>
-S<Service_Name as contained in the TNS file>
If you run the test program without any parameters, it displays help
information that describes the required parameters.
The test program displays information about each Oracle operation it
performs and indicates whether each operation was successful.
7. If the Oracle test program is able to connect to your Oracle database
server without error, then it is very likely that MTS works with Oracle
also. If the Oracle test program reports any errors, follow these steps:
- Document the exact error message that the Oracle test program
displays.
- Examine the Oracle trace file produced when running the Oracle test
program. The Oracle trace information is located in the *.TRC file.
The Oracle trace file contains extended error information that is
extremely helpful in diagnosing problems.
- Contact your Oracle support representative for assistance.
Validating Oracle Installation and Configuration Using the Sample Bank
Application
After you have validated your Oracle installation and configuration using the Oracle test program, you should use the Sample Bank Application supplied with Microsoft Transaction Server to make sure that Microsoft Transaction Server can access your Oracle database.
1. Verify that your Oracle system installation and configuration is correct
by using the Oracle test program provided by MTS. If the Oracle test
program reports any error, you must correct that problem before
proceeding.
2. On the Oracle database server, create a table named "Account". The
following example demonstrates how to set up the Account table:
Owner scott
Name of Table Account
Column 1 Name AccountNo of type NUMBER
Column 2 Name Balance of type NUMBER
3. Populate the Account table with at least two rows. The following table
illustrates how to populate the table:
AccountNo Balance
--------------------------
1 1000
2 1000
4. On the Oracle database server, create a table named Receipt. The
following example demonstrates how to set up the Receipt table:
Owner scott
Name of Table Receipt
Column 1 Name NextReceipt of type NUMBER
5. Populate the Receipt table with at least one row. The following example
illustrates how to populate the table:
NextReceipt
1000
6. Create a file DSN using the ODBC configuration utility. Name the file
DSN "MTSSamples". Next, manually update the DSN file to add the user’s
password. The following example demonstrates how to add the user’s
password to a file DSN:
[ODBC]
DRIVER=Microsoft ODBC for Oracle
UID=scott
PWD=mypassword
ConnectString=myserver
SERVER=myserver
7. Save the file DSN and run the Sample Bank client.
Oracle changes .dll names when they release new versions of their product. Microsoft Transaction Server relies upon knowing the name of some Oracle Client .Dlls. MTS stores these .dll file names in the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\ Microsoft\Transaction
Server\Local Computer\My Computer
By default, Microsoft Transaction Server stores the Oracle 7.3 Client DLL
names as two string-named values:
OracleXaLib "xa73.dll"
OracleSqlLib "sqllib18.dll"
If you want to use Oracle 8 Client software, you must change these values
to specify the names of the Oracle 8 Client software DLLs:
OracleXaLib "xa80.dll"
OracleSqlLib "sqllib80.dll"
Changing the UserId under Which Microsoft Distributed Transaction
Coordinator (DTC) Runs
Microsoft Distributed Transaction Coordinator maintains information in the secure portion of the Windows NT registry. It uses this information when performing recovery with XA compliant databases including Oracle. If you change the userid under which Microsoft Distributed Transaction Coordinator executes, you must be careful to ensure that Microsoft Distributed Transaction Coordinator can still access the information it has previously stored in the secure portion of the registry.
If you change Microsoft Distributed Transaction Coordinator’s userid, and it is unable to access the information in the secure registry, you see the following message in the Windows NT event log:
XATM log object failed to set log encryption key.
You can correct this problem with the following steps:
1. Stop Microsoft Distributed Transaction Coordinator.
2. Change the userid for the Microsoft Distributed Transaction Coordinator
back to its previous value. Alternately, you can assign a userid that is
a member of the administrative group. To change the userid and pass
word, run the Services applet in Control Panel, double-click the
entry for "MSDTC", and change the "log on as" value.
3. Restart Microsoft Distributed Transaction Coordinator.
If you want to create more than a few dozen connections to an Oracle database, you must configure the Oracle server to support additional database connections.
You may experience one or more of the following errors if you fail to do this:
Too many sessions
TNS server failed to locate the server name
Too many distributed transactions
Oracle Configuration Parameter Notes
--------------------------------------------------------------------
sessions The value for sessions should
typically be three times the total
number of database connections
that you expect your applications
to make.
distributed_lock_timeout
distributed_transactions
dml_locks
max_transaction_branches
open_cursors
processes
queuesize If the queue size for the Oracle
Listener process is inadequate,
The Listener sometimes falls
behind and rejects database open
requests. This happens if the
Oracle Listener receives too many
connection requests and its queue
overflows. A client that
encounters this error reports the
following error message and the
client log or trace files show
the ECONREFUSED message:
ORA-12541: No Listener
To correct this problem follow
these steps:
1. Stop the Oracle listener on the
system containing the Oracle
database server.
2. Increase the QUEUESIZE
parameter in the Listener.ora,
Tnsnet.ora, or Names.ora files
on the Oracle database server
system. Choose the queue
size based on the number of
simultaneous, or nearly
simultaneous, connection
requests you anticipate.
We suggest that you select a
generous value for QUEUESIZE
because the Oracle system
typically opens more than one
database connection for each
transactional database
connection that your
application opens. As a
result, the Oracle listener
queue may become full and
overflow.
To accommodate 100 requests,
change the LISTENER.ORA file
as follows:
QUEUESIZE = 100
3. Restart the Oracle listener.
If your applications use ADO, make certain that you install the ADO 1.5c release or later. Please refer to the Required Software section for more information.
It is important that have the correct version of the Ociw32.dll file installed on your computer. You should check the version of this .dll file every time you reinstall Oracle software.
Microsoft Transaction Server applications that reside on MSCS (Wolfpack) clusters cannot access XA databases, including Oracle databases. This is the result of a limitation in Microsoft Distributed Transaction Coordinator.
Currently, Microsoft Distributed Transaction Coordinator stores encryption information related to XA recovery in the Windows NT registry. Currently, you cannot replicate this information between the two nodes in an MSCS cluster. As a result, you cannot use Microsoft DTC with any XA compliant database in a clustered environment. The Windows NT 4.0 Service Pack 4 eliminates this restriction.
This problem occurs because both MTS and MS DTC must load the Oracle Ociw32.dll file on their main thread before doing any operation that might access an Oracle database. MTS must load the Mtxoci.dll file because your application may want to open a connection to an Oracle database. MS DTC must load the Mtxoci.dll file because it may need to perform Oracle database recovery. Since we cannot predict whether your application may want to use an Oracle database, we always load the Ociw32.dll file.
We are forced to load the Ociw32.dll file unconditionally at initialization because of the way that Oracle is implemented on Windows NT. Oracle's implementation on Windows NT monitors all thread attaches. It insists on seeing all thread attaches and only accepts database open requests from threads for which it has seen the initial thread attach. Because of this, we cannot just fault in the Oracle support DLLs when you actually use them.
You can circumvent this problem using one of the following two methods:
If you never use Oracle with MTS or MS DTC, you can rename or delete the Microsoft Oracle database support .dll file, Mtxoci.dll. When you initiate MTS and MS DTC, they look for and load the Mtxoci.dll file. The Microsoft Mtxoci.dll then loads the Oracle Ociw32.dll file. MTS and MS DTC continue to work properly if they cannot locate and load the Mtxoci.dll file. However, they cannot access or recover an Oracle database if this .dll file is absent.
Alternately, you can install the Oracle Ociw32.dll file designed to work with the Oracle 7.3 release. You can find this .dll file in the WIN32\V7\RSF73 directory of the Oracle 7.3 CD-ROM. You must install version 1.0.0.5 or later of this .dll file.
Oracle includes an older version of the Ociw32.dll file on the Oracle 7.3 CD-ROM that is designed to work with the Oracle 7.2 release. You can find this .dll file in the WIN32\V7\RSF72 directory. This .dll file does not work with Microsoft Transaction Server. The following version of the Oracle Ociw32.dll file is provided in the WIN32\V7\RSF72 director and fails when used with Microsoft Transaction Server:
Version 7.x
Thursday, February 01, 1996 12:50:06 AM
Size 36 KB
The Oracle 7 test program, TestOracleXaConfig.exe, installs as part of the Microsoft Transaction Server 2.0 release. The source code for the Oracle 8 test program follows. You can compile this source code using the C++ compiler to product the Oracle 8 test program. The instructions assume that you call the resulting executable file TestOracleXaConfig.exe.
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
// Found this necessary to get things to work with Oracle's xa.h
#define __STDC__ 1
#include "xa.h"
extern "C"
{
#include <oratypes.h> /* LDA and CDA struct declarations. */
#include <ocidfn.h>
#include <ocidem.h> /* Demo constants and structs. */
#include <ociapr.h>
}
//---------------------------------------------------------
// TYPEDEFS
//---------------------------------------------------------
typedef void __cdecl TYPE_sqlld2 (struct cda_def *lda, text *cname,
sb4 *cnlen);
typedef short __cdecl TYPE_oopen (struct cda_def*, struct cda_def*,
text*, sword, sword, text*, sword);
typedef sword __cdecl TYPE_opinit (ub4 mode);
#define MAX_STR_BUFFER 300
//---------------------------------------------------------
// PROTOTYPES
//---------------------------------------------------------
BOOL ValidateCommandLineArgs(int,char**);
BOOL GetLibsAndFuncs();
BOOL DoWork(void);
//---------------------------------------------------------
// GLOBALS
//---------------------------------------------------------
static HINSTANCE g_hinstXALIB; // Saved handle to
XA73.dll
static HINSTANCE g_hinstSQLLIB; // Saved handle to
SQLLIB18.dll
static HINSTANCE g_hinstOCILIB; // Saved
handle to OCIW32.dll
xa_switch_t * g_pXaSwitch;
TYPE_sqlld2 * g_pfnSqlLD2;
TYPE_oopen * g_pfnOopen;
TYPE_opinit * g_pfnOpinit;
XID g_xid;
char g_szUser[MAX_STR_BUFFER];
char g_szPassword[MAX_STR_BUFFER];
char g_szServer[MAX_STR_BUFFER];
Lda_Def lda;
ub4 hda[HDA_SIZE/sizeof(ub4)];
Cda_Def cda1;
/* ------------------------------------------------------------------
@func main
-------- */
int main (int cArgs, char** ppszArgs)
{
memset ((void *) &lda, 0x0, sizeof (lda));
//Create the xid
g_xid.formatID = 0101;
g_xid.gtrid_length = 5;
g_xid.bqual_length = 1;
printf("\n");
printf("\n****** MTS/Oracle Configuration Test Utility ******\n");
if (!ValidateCommandLineArgs(cArgs, ppszArgs))
goto done;
if (!GetLibsAndFuncs())
goto done;
if (!DoWork())
goto done;
printf("\n\nTest successfully completed!\n");
done:
return 0;
}
/* ------------------------------------------------------------------
@func DoWork
-------- */
BOOL DoWork (void)
{
char szOpenString[MAX_STR_BUFFER];
int rc;
struct cda_def LDA;
long lVal = -1;
char szDBName[MAX_STR_BUFFER];
//-------------------------------------------------------------------
// Connect to the Oracle database.
strcpy(szDBName, "TEST");
sprintf (szOpenString,
"Oracle_XA+Acc=P/%s/%s+SesTm=440+DB=%s+SqlNet=%s+Threads=TRUE",
//"Oracle_XA+Acc=P/%s/%s+SesTm=440+DB=%s+SqlNet=%s",
g_szUser,
g_szPassword,
szDBName,
g_szServer);
printf("\nCalling xa_open_entry...");
rc = g_pXaSwitch->xa_open_entry
(
szOpenString,
1,
TMNOFLAGS
);
if (rc != XA_OK)
{
printf ("call failed with the return code = %d\n", rc);
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
//Enlist this Xa connection on a new transaction.
printf("\nCalling xa_start_entry...");
rc = g_pXaSwitch->xa_start_entry
(
&g_xid,
1,
TMNOFLAGS
);
if (rc != XA_OK)
{
printf ("call failed with the return code = %d\n", rc);
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
//Open a cursor.
printf("\nCalling opinit...");
if (rc = g_pfnOpinit(OCI_EV_TSF))
{
printf ("call failed with the return code = %d\n", rc);
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
// Get the lda for the connection by calling sqlld2.
printf("\nCalling sqlld2...");
g_pfnSqlLD2 (
&LDA,
(unsigned char *)szDBName,
&lVal
);
if (LDA.rc)
{
printf ("call failed with the return code = %d\n", LDA.rc);
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
// Open a cursor.
printf("\nCalling oopen...");
if ((rc = g_pfnOopen(&cda1, &LDA, (text *) 0, -1, -1, (text *) 0, -
1)))
{
printf ("call failed with the return code = %d\n", rc);
return FALSE;
}
printf("succeeded");
return TRUE;
} //end DoWork
/* -------------------------------------------------------------------
@func GetLibsAndFuncs
------- */
BOOL GetLibsAndFuncs()
{
//--------------------------------------------------------------------
// load xa dll
printf("\nLoading XA80.DLL...");
if ((g_hinstXALIB = LoadLibrary("xa80.dll")) == NULL)
{
printf("\nLoadLibrary on XA80.DLL failed!\n");
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
// load sqllib dll
printf("\nLoading SQLLIB80.DLL...");
if ((g_hinstSQLLIB = LoadLibrary("sqllib80.dll")) == NULL)
{
printf("\nLoadLibrary on SQLLIB80.DLL failed!\n");
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
//load ociw32 dll
printf("\nLoading OCIW32.DLL...");
if ((g_hinstOCILIB = LoadLibrary("ociw32.dll")) == NULL)
{
printf("\nLoadLibrary on OCIW32.DLL failed!\n");
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
// Get the xa_switch.
printf("\nGetting the xa_switch switch...");
g_pXaSwitch = (xa_switch_t *) GetProcAddress ( g_hinstXALIB, "xaosw"
);
if (g_pXaSwitch == NULL)
{
printf("\nGetProcAddress on ""xaosw"" in XA80.DLL failed!\n");
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
// Get the sqlld2 function.
printf("\nGetting the sqlld2 function...");
g_pfnSqlLD2 = (TYPE_sqlld2 *) GetProcAddress ( g_hinstSQLLIB, "sqlld2"
);
if (g_pfnSqlLD2 == NULL)
{
printf("\nGetProcAddress on ""sqlld2"" in SQLLIB80.DLL failed!\n");
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
// Get the opinit function.
printf("\nGetting the opinit function...");
g_pfnOpinit = (TYPE_opinit*) GetProcAddress( g_hinstOCILIB, "opinit"
);
if (g_pfnOpinit == NULL)
{
printf("\nGetProcAddress on ""opinit"" in OCIW32.DLL failed!\n");
return FALSE;
}
printf("succeeded");
//--------------------------------------------------------------------
// Get the oopen function.
printf("\nGetting the oopen function...");
g_pfnOopen = (TYPE_oopen*) GetProcAddress( g_hinstOCILIB, "oopen" );
if (g_pfnOopen == NULL)
{
printf("\nGetProcAddress on ""oopen"" in OCIW32.DLL failed!\n");
return FALSE;
}
printf("succeeded");
return TRUE;
}
/* -------------------------------------------------------------------
@func ValidateCommandLineArgs
------- */
BOOL ValidateCommandLineArgs(int cArgs, char** ppszArgs)
{
long i;
BOOL bServerSet = FALSE;
char szUsage[] = "\n"
"This utility performs a basic configuration check of your Oracle
server\n"
"to test for proper operation with Microsoft Transaction Server.\n"
"\n"
"Usage: testoraclexaconfig.exe [-U<username>] [-P<password>] –
S<sqlnet name>\n"
"\n"
"Defaults for <username> and <password> are scott and tiger.\n"
"\n"
"Example: testoraclexaconfig.exe -UMyUserName -PMySpecialPassword –
SMyOracleServer\n";
// Initialize defaults
strcpy(g_szUser, "scott");
strcpy(g_szPassword, "tiger");
strcpy(g_szServer, "");
for (i=1; i < cArgs; i++)
{
if (*ppszArgs[i] == '-' || *ppszArgs[i] == '/')
{
switch (ppszArgs[i][1])
{
// 'u' -- set user name
case 'u':
case 'U':
strcpy(g_szUser, &(ppszArgs[i][2]));
break;
// 'p' -- set password
case 'p':
case 'P':
strcpy(g_szPassword, &(ppszArgs[i][2]));
break;
// 's' -- set server name
case 's':
case 'S':
strcpy(g_szServer, &(ppszArgs[i][2]));
bServerSet = TRUE;
break;
case '?':
printf("%s", szUsage);
return FALSE;
break;
default:
goto badarg;
}
}
else
goto badarg;
}
if (!bServerSet)
goto badarg;
return TRUE;
badarg:
printf("%s", szUsage);
return FALSE;
}
For the latest information on Microsoft Transaction Server, please see the following World Wide Web site:
http://www.microsoft.com/
Additional query words: kbMTS kbOracle KbClientServer
Last Reviewed: October 15, 1998