Hi guys,
I have upgraded C++ ETL software that connects to databases via ODBC. This software is very stable and has been in use for 8 years now. It is being used in 32 bit mode on plenty of 2008R2 servers and there has been no connection time problems.
However, I have decided to upgrade the base development environment to 2008 x64 and SQL Server 2008 R2 since all my customers are there now and I do not have to worry about backward compatibility issues and maintain multiple copies of the code.
I created an 2008 server, just a regular one, and put 2008r2 on it. Other applications like our vb.net app work well..connection times normal etc.
However, the C++ ODBC connection takes about 4 seconds each time it creates a connection. An execute immediate (code below) is taking 4 seconds.
I am not really very sure where to look to see where the problem might be as no database, sql server or others, that I have worked on in the last 8 years has ever taken 4 seconds to execute a statement with execute immediate. These statements generally are executed very quickly...subsecond.
If anyone could give me a hint or some advice where to look on this instance to see if there is some setting or some authentication process that could be getting in the way I would really appreciate it....with messages and auditing it is making testing of new things painfully slow.
Best regards
Peter
BOOL CODBCDatabase::Execute(CHAR *szSqlStr)
BEGIN_
SQLHSTMT hStmt = NULL;
// SQLINTEGER nRowCount;
SQLLEN nRowCount;
// SQLLEN nRowCount2 ;
nRowCount = 0 ;
SQLCODE = SQLAllocHandle(SQL_HANDLE_STMT, DBConnectionHandle, &hStmt);
//////////////////////////////////////////////////////////////////////////////////////////////
// Check the call. //
//////////////////////////////////////////////////////////////////////////////////////////////
SQL_OK = SQLCODE_SUCCEEDED(SQLCODE) ;
CALL_RETURNED_OK = SQL_OK ;
IF (CALL_RETURNED_OK) THEN
BEGIN_
SQLCODE = SQLExecDirect(hStmt, (SQLCHAR*)szSqlStr, SQL_NTS);
//////////////////////////////////////////////////////////////////////////////////////////////
// Check the call. //
//////////////////////////////////////////////////////////////////////////////////////////////
SQL_OK = SQLCODE_SUCCEEDED(SQLCODE) ;
//////////////////////////////////////////////////////////////////////////////////////////////
// If the call did not work then get the error messages using the //
// GetConnectionHandleErrorMessages method and return the fact that the call did not work. //
//////////////////////////////////////////////////////////////////////////////////////////////
IF (!SQL_OK) THEN
BEGIN_
GetConnectionHandleErrorMessages(DBConnectionHandle) ;
END_
CALL_RETURNED_OK = SQL_OK ;
IF (CALL_RETURNED_OK) THEN
BEGIN_
SQLCODE = SQLRowCount(hStmt, &nRowCount);
//////////////////////////////////////////////////////////////////////////////////////////////
// Check the call. //
//////////////////////////////////////////////////////////////////////////////////////////////
SQL_OK = SQLCODE_SUCCEEDED(SQLCODE) ;
CALL_RETURNED_OK = SQL_OK ;
NumRowsAffected = nRowCount;
END_
END_
IF (hStmt != SQL_NULL_HANDLE ) THEN
BEGIN_
SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
hStmt = SQL_NULL_HANDLE;
END_
return CALL_RETURNED_OK ;
END_
I have upgraded C++ ETL software that connects to databases via ODBC. This software is very stable and has been in use for 8 years now. It is being used in 32 bit mode on plenty of 2008R2 servers and there has been no connection time problems.
However, I have decided to upgrade the base development environment to 2008 x64 and SQL Server 2008 R2 since all my customers are there now and I do not have to worry about backward compatibility issues and maintain multiple copies of the code.
I created an 2008 server, just a regular one, and put 2008r2 on it. Other applications like our vb.net app work well..connection times normal etc.
However, the C++ ODBC connection takes about 4 seconds each time it creates a connection. An execute immediate (code below) is taking 4 seconds.
I am not really very sure where to look to see where the problem might be as no database, sql server or others, that I have worked on in the last 8 years has ever taken 4 seconds to execute a statement with execute immediate. These statements generally are executed very quickly...subsecond.
If anyone could give me a hint or some advice where to look on this instance to see if there is some setting or some authentication process that could be getting in the way I would really appreciate it....with messages and auditing it is making testing of new things painfully slow.
Best regards
Peter
BOOL CODBCDatabase::Execute(CHAR *szSqlStr)
BEGIN_
SQLHSTMT hStmt = NULL;
// SQLINTEGER nRowCount;
SQLLEN nRowCount;
// SQLLEN nRowCount2 ;
nRowCount = 0 ;
SQLCODE = SQLAllocHandle(SQL_HANDLE_STMT, DBConnectionHandle, &hStmt);
//////////////////////////////////////////////////////////////////////////////////////////////
// Check the call. //
//////////////////////////////////////////////////////////////////////////////////////////////
SQL_OK = SQLCODE_SUCCEEDED(SQLCODE) ;
CALL_RETURNED_OK = SQL_OK ;
IF (CALL_RETURNED_OK) THEN
BEGIN_
SQLCODE = SQLExecDirect(hStmt, (SQLCHAR*)szSqlStr, SQL_NTS);
//////////////////////////////////////////////////////////////////////////////////////////////
// Check the call. //
//////////////////////////////////////////////////////////////////////////////////////////////
SQL_OK = SQLCODE_SUCCEEDED(SQLCODE) ;
//////////////////////////////////////////////////////////////////////////////////////////////
// If the call did not work then get the error messages using the //
// GetConnectionHandleErrorMessages method and return the fact that the call did not work. //
//////////////////////////////////////////////////////////////////////////////////////////////
IF (!SQL_OK) THEN
BEGIN_
GetConnectionHandleErrorMessages(DBConnectionHandle) ;
END_
CALL_RETURNED_OK = SQL_OK ;
IF (CALL_RETURNED_OK) THEN
BEGIN_
SQLCODE = SQLRowCount(hStmt, &nRowCount);
//////////////////////////////////////////////////////////////////////////////////////////////
// Check the call. //
//////////////////////////////////////////////////////////////////////////////////////////////
SQL_OK = SQLCODE_SUCCEEDED(SQLCODE) ;
CALL_RETURNED_OK = SQL_OK ;
NumRowsAffected = nRowCount;
END_
END_
IF (hStmt != SQL_NULL_HANDLE ) THEN
BEGIN_
SQLFreeHandle(SQL_HANDLE_STMT, hStmt);
hStmt = SQL_NULL_HANDLE;
END_
return CALL_RETURNED_OK ;
END_
Peter Nolan