Microsoft KB Archive/286204

= PRB: Slow CGI Performance with Microsoft ODBC for Oracle on Windows NT 4.0 =

Article ID: 286204

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Data Access Components 2.5
 * Microsoft Data Access Components 2.5 Service Pack 1
 * Microsoft Data Access Components 2.6

-



This article was previously published under Q286204



SYMPTOMS
After installing Microsoft Data Access Components (MDAC) version 2.5 or later, the open and close performance of a single connection to the Microsoft ODBC for Oracle driver is noticeably slower. This impacts the performance of typical single connection open/close applications such as Common Gateway Interface (CGI) applications.



RESOLUTION
To fix the performance problem, add the following code to your application prior to opening the first connection to the Microsoft ODBC for Oracle driver: LoadLibrary( &quot;mtxdm.dll&quot; ); LoadLibrary( &quot;mtxoci.dll&quot; );



STATUS
This behavior is by design.



MORE INFORMATION
This issue does not impact applications that load and unload connections over and over and continue to run. The problem applies only to applications that start up, open a connection, close the connection, and then terminate.

This problem does not occur on Microsoft Windows 2000; it has only been reported on Microsoft Windows NT 4.0 with MDAC 2.5 or later installed. The problem may also occur on Microsoft Windows 95, Windows 98, and Windows Millennium Edition (Me), but this has not been tested.

Steps To Reproduce Behavior
To reproduce the problem, create a new Microsoft Visual C++ console application and add the following code. Run the code sample with the calls to LoadLibrary commented out (as they are below), and then run the sample again with the code uncommented. The performance with the calls in place should be faster. // START CODE SAMPLE
 * 1) include 
 * 2) include 
 * 3) include 
 * 4) include 
 * 5) include 

// Helper function to print elapsed time. void PE( char* pszCaption, DWORD dwStart ) {   DWORD dwElapsed; dwElapsed = GetTickCount - dwStart; printf( &quot;[%20s] Elapsed %04lu.%04lu.\n&quot;,            pszCaption,             dwElapsed/1000,             dwElapsed%1000 ); }

void main(void) {      RETCODE rc; HENV   henv    = NULL; HDBC   hdbc    = NULL;

// Set this to your Oracle DSN, UID and PWD. SQLCHAR szConnect[] = &quot;DSN=ORACLE805;UID=PSS;PWD=PSS;&quot;; DWORD dwStart, i;

for( i=1; i<=3; i++ ) {       dwStart = GetTickCount;

printf( &quot;=========================================\n&quot; );

// Un-comment these 2 lines to fix problem. // LoadLibrary( &quot;mtxdm.dll&quot; ); // LoadLibrary( &quot;mtxoci.dll&quot; );

// Allocate environment handle. rc = SQLAllocEnv( &henv ); PE( &quot;SQLAllocEnv&quot;, dwStart );

// Allocate connection handle. rc = SQLAllocConnect( henv, &hdbc ); PE( &quot;SQLAllocConnect&quot;, dwStart );

// Connect to data source. rc = SQLDriverConnect( hdbc,                       NULL,                        szConnect,                        SQL_NTS,                        NULL,                        0,                        NULL,                        SQL_DRIVER_NOPROMPT ); PE( &quot;SQLDriverConnect&quot;, dwStart );

// Disconnect and free connection and henv. rc = SQLDisconnect( hdbc ); PE( &quot;SQLDisconnect&quot;, dwStart );

rc = SQLFreeConnect( hdbc ); PE( &quot;SQLFreeConnect&quot;, dwStart );

rc = SQLFreeEnv( henv ); PE( &quot;SQLFreeEnv&quot;, dwStart );

henv = NULL; hdbc = NULL;

}

printf( &quot;Press any key to exit test.\n&quot; ); _getch;

} // END CODE SAMPLE

Keywords: kbbug kboracle kbqfe kbprb KB286204

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.