When two or more threads share the same database connection (but differenthstmts), a call to SQLExecDirect or SQLExecute fails, and one of thefollowing errors occurs:
- [Microsoft][ODBC SQL Server Driver][SQL Server] Received an unrecognized datatype 0 from TDS data stream
- [Microsoft][ODBC SQL Server Driver]Unknown token received from SQL Server
- [Microsoft][ODBC SQL Server Driver]Protocol error in TDS stream
The error(s) received depends on which network library (TCP/IP sockets ornamed pipes) is being used.
When you use server side cursors, SQL Server Driver invokes the extendedstored procedure Sp_cursoropen with incorrect parameters when the followingconditions are met:
- The number of parameter markers in the WHERE clause of a SELECT statement are more than one.
- The parameter markers correspond to CHAR or VARCHAR datatypes.
- The network packet size is set to 512 bytes in the server configuration/options.
In addition, SQL Server Driver generates the following error message:
szSqlState = "37000", *pfNativeError = 16903,
szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server]
sp_cursoropen procedure called with incorrect number of parameters".
The following error message appears if any further activity occurs on theclient side:
Communication link failure.
If SQLDescribeCol is called after preparing an outer join statement, itreturns the following error:
szSqlState = "37000", *pfNativeError = 107, *pcbErrorMsg = 135
szErrorMsg="[Microsoft][ODBC SQL Server Driver][SQL Server]
The column prefix 'c1' does not match with a table name or
alias name used in the query."
The SQLBindParameter fails after binding a parameter with SQL_C_DEFAULT andSQL_TINYINT under Simplified Chinese Win95. The following error isgenerated:
szErrorMsg="[Microsoft][ODBC SQL Server Driver]Restricted data type attribute violation"
The following statements demonstrate the problem scenario:
SQLExecDirect(hstmt, "Create table mytable(id int)", SQL_NTS); SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_DEFAULT, SQL_TINYINT, 1, 0, &sId, 0, &cbId ); SQLExecDirect(hstmt, "select * from mytable where id=?", SQL_NTS);
FIX: Driver Not Capable Error: SQL_COPT_SS_CONNECTION_DEAD
BUG #: 16166 (2.65.0201)
Users who attempt to call SQLGetConnectOption for the Microsoft SQL ServerODBC Driver specific connection option SQL_COPT_SS_CONNECTION_DEAD receivethe following error:
szSqlState = "S1C00", *pfNativeError = 0 szErrorMsg="[Microsoft][ODBC SQL Server Driver] Driver not capable"
FIX: 16-Bit Driver Keyset Cursor Operations with Query Timeout
BUG #: 15946 (WINDOWS SQLBUG 2.65.0212)
When you use the client-side SPX Net-Library for Windows (Dbmsspx3.dll),the Microsoft SQL Server 16-bit ODBC Driver version 2.65 may performsignificantly slower in operations involving both keyset-driven cursors andthe setting of a query timeout. Microsoft has observed a difference up to afactor of six when Dbmsspx3.dll is used, versus the other available net-libraries. Note that for this problem to occur, both a query timeout mustbe set and keyset-driven cursors must be in use with Dbmsspx3.dll.
FIX: Server Out of Memory when Inserting into Text/Image Fields
Using the 32-bit SQL Server Open Database Connectivity (ODBC) driver toinsert chunks of data into text/image columns with the SQLPutData API maycause error 701, "There is insufficient memory to execute the query," fromSQL Server 6.5.
When an identity column is added to an existing table using the ALTER TABLEstatement, SQLColAttributes and SQLDescribeCol report that the identitycolumn allows NULLS.
If you set up a FOREIGN KEY constraint to reference a table that ispopulated by replication (that is, a subscribed table), a constraintviolation may occur if an UPDATE is run against the published table. Thiswill cause the distribution task to fail with the following error:
Msg 547, %s statement conflicted with %s constraint '%.*s'. The conflict occurred in database '%.*s', table '%.*s'%s%.*s%s
The NOT FOR REPLICATION option should allow changes submitted by theDistribution task on columns referenced by a FOREIGN KEY constraint fromanother table that otherwise would violate the constraint.
Any SQLExec task that uses DB-Library can have its query timeout affectedby a replication task. Replication tasks use a DB-Library function toglobally set the query timeout for the SQLExecutive process, therebyaffecting all "DB-Library based" tasks including TSQL, LogReader, SYNC, andDistribution tasks.
Because of this problem, replication tasks may encounter the followingmessage in the Task History:
SQL Server connection timed out. Unable to successfully execute <command> on <server>
SQLExecutive will automatically retry the replication task, but the taskmay never run if the query timeout is not long enough.
TSQL tasks may encounter the following error as a Failure:
SQL Server connection timed out. (Error 10024)
When you use SQL Server replication with the code page 932 installed, somereplication commands may not be successfully run, resulting in someJapanese characters being mistakenly replicated in the subscribing table.
FIX: Replicated UPDATE to Char Column May Cause Error 803
BUG #: 15829 (Windows NT: 6.5)
LogReader fails with error 803. The errorlog and the task history shows thefollowing message:
Error : 803, Severity: 20, State: 1
Unable to place buffer %*.d holding logical page %*.d in sdes for object 'syslogs' - either there is no room in sdes or buffer already in requested slot.
When you are replicating a table with a text column, and character modeBulk Copy is used as the mode of synchronization, the SQL Executive servicemay become unstable. The distribution task is left in a sleeping state, andthe SQL Executive service cannot be controlled. The server must berestarted to reactivate the task.
When this problem occurs, the SQL Executive service on the distributorbecomes unstable. Also, Enterprise Manager stops responding if you try toclick on the running tasks, because the server will not be able to runextended stored procedures related to the SQL Executive service.
Not all tables with a text column will experience this problem. However,tables with a text column are more likely candidates for failure, becausethe character mode of synchronization is used for such tables by default.
Character mode bulk copy program (BCP) replication synchronization causes amemory leak in SQL Executive.
The amount of memory leaked builds up each time a BCP character mode job isrun by the distribution task. Once the system becomes sufficiently low onmemory, the distribution task may fail or stop responding. If the taskfails, it will return the error "Failed to allocate memory" to the taskhistory. If the distribution task stops responding, it will be listed inthe Sysprocesses table as a sleeping process with the command "select *from <table_name>."
Other possible symptoms include SQL Executive unhandled exception errorsand other SQL Executive memory allocation failures.
To work around this problem, do one of the following:
- Use a Critical Section object around SQLExecDirect or SQLExecute.
- Use a different connection for each thread, rather than sharing the same connection.
- Add a Sleep function for about 1,000 to 5,000 milliseconds before SQLExecDirect or SQLExecute.
FIX: Sp_cursoropen Error With More Than One Parameter Marker
BUG #: 15743 (2.65.0201)
Set the Network Packet Size greater than 512 bytes in ServerConfiguration/Options using Sp_configure.
FIX: SQLDescribeCol Returns Error on Prepared Outer Join
BUG #: 16200 (2.65.0201)
Call SQLDescribeCol after running the prepared statement.
FIX: SQLBindParameter Fails Under Simplified Chinese Win95
The amount of data inserted into the image/text field can be increased byincreasing the amount of memory allocated to SQL Server and the amount ofmemory allocated to the procedure cache.
FIX: SQLDescribeCol/SQLColAttributes Report Nullability Wrong
Use the Column nullability information derived from SQLColumns.
FIX: Fkey NOT FOR REPLICATION Doesn't Work Correctly
BUG #: 13700 (Windows NT: 6.5)
Change your UPDATE statement to run as an "on-page delete/insert." Foradditional information, please see the following article in the MicrosoftKnowledge Base:
If you cannot change your UPDATE statement to meet this criteria, you maynot be able to create a FOREIGN KEY constraint in the subscribed databaseto reference a subscribed table.
FIX: Replication Tasks Affect Query Timeout for Other SQLExec
BUG #: 15540 (6.0) 15573 (6.5) (sqlserver)
Override the default query timeout for any SYNC or Distribution task withthe -q0 parameter value (This is only needed for SQL Server 6.5 because thedefault query timeout for these tasks is 30 seconds, but is 0 for SQLServer 6.0). This can force all tasks to use an infinite query timeout(which is the default for TSQL and LogReader tasks).
For TSQL tasks, you could instead use a CmdExec task using Isql.exe withthe -t parameter to force a query timeout.
FIX: Replication of Japanese DBCS Character Fails
To work around this problem, drop the index on the character column that isbeing updated. If this is not possible, use Scheduled Table Refresh fortables that are required to be published using partitioning at least seventimes.
FIX: SQL Executive Service Becomes Unstable While Replicating
While doing the synchronization, use the native mode of Bulk Copy. Thenative mode can only be used for SQL Server subscribers when the tablebeing published has at least one text column.
FIX: Character Mode BCP Causes a Memory Leak in SQL Executive
To work around this problem, use the native mode BCP for either automaticsynchronization or manual synchronization.