Kevin J. Boske
Microsoft Corporation
December 2001
Summary: Microsoft SQL Server 2000 Windows CE Edition (SQL Server CE) includes a robust error reporting mechanism that provides information about errors returned from a variety of sources. This paper describes how SQL Server CE errors are generated and how and where to find more information about these errors. The paper also describes some of the common connectivity errors that occur when running SQL Server CE and replication or Remote Data Access (RDA). (29 printed pages)
Contents
Introduction
Troubleshooting General Connectivity Issues
Troubleshooting Replication Issues
Troubleshooting RDA Issues
Conclusion
References
Introduction
Microsoft® SQL Server™ 2000 Windows® CE Edition (SQL Server CE) includes a robust error reporting mechanism that provides information about errors returned from a variety of sources. This paper describes how SQL Server CE errors are generated and how and where to find more information about these errors. The paper also describes some of the common connectivity errors that occur when running SQL Server CE and replication or Remote Data Access (RDA).
Troubleshooting General Connectivity Issues
This section covers how to determine the source of errors related to connectivity, error handling in eMbedded Microsoft Visual Basic® (eVB) and eMbedded Microsoft Visual C++® (eVC), SQL Server CE Server Agent logging, and other connectivity issues you may encounter.
Identifying the Source of Errors
Many SQL Server CE errors are returned in scenarios in which a single error cannot fully explain the point of failure. For example, the error 28037 (HTTPSENDREQUESTFAILED) can be returned for a variety of reasons. This error reports that a connection to Microsoft Internet Information Services (IIS) cannot be made; the IIS server may be down, the network or Internet service provider (ISP) may be experiencing failures, or the problem may be as simple as an incorrect property setting in the SQL Server CE Microsoft ActiveX® control. Whatever the failure, handling errors in your code is the first step in discovering the nature of the issue.
The SQL Server CE Errors object consists of an HRESULT, a Native Error, and parameters. The Native Error is returned from SQL Server CE. The HRESULT can be returned from SQL Server, the OLE DB application programming interface (API), or IIS, for example. Each error may include parameters that provide additional information about the failure. You should step through the entire errors collection and parameter list in your error handling code. In many cases, the last error returned in the collection describes the failure.
Native errors
SQL Server CE can return errors from SQL Server CE Engine (SSCE10.dll), SQL Server CE Client Agent (SSCECA10.dll), SQL Server CE Server Agent (SSCESA10.dll), the transport protocols, or SQL Server for CE Relay (SSCERELAY.exe). The following table shows the numeric ranges of SQL Server CE errors.
| SQL Server CE component | Native Error range |
| Engine (SSCE10.dll) | 25001–25087
25200–25209
25500–25556
25900–25945
26100–26102
26300–26308
27000–27005
27500–27502
27700 |
| SQL Server CE Client Agent (SSCECA10.dll) | 28500–28573 |
| SQL Server CE Server Agent (SSCESA10.dll) | 29000–29045 |
| Transport protocols (replication and RDA) | 28000–28499 (replication)
29500–29999 (message protocol) |
| Relay (sscerelay.exe) | 30000–30034 |
The return parameters from the SQL Server CE Engine and Client Agent do not contain error descriptions. You can find error descriptions in SQL Server CE Books Online by searching on the Native Error.
HRESULTs
HRESULTs are returned from several sources: SQL Server (versions 6.5, 7.0, or 2000), IIS, Certificate Services, Windows CE, or OLE DB. Some HRESULT sources (such as SQL Server 2000) return descriptions, but a few sources (such as OLE DB and Windows CE) require additional research. The following table indicates where to find more information about HRESULT values that are returned from these sources.
| HRESULT defined in | Range of HRESULT values |
| OLEDBErr.h | Hexadecimal values 0x80040EFF–0x80040E9A |
| Wininet.h | Hexadecimal values that begin with 0x80072EE0–0x8007209F (decimal values 12000–12159) |
| Winerror.h | Decimal errors: 1–11999 |
Windows errors
Windows errors can be found in wininet.h or winerror.h. Decimal errors in the range of 1 through 11999 can be found in winerror.h. A separate winerror.h file is installed with the Microsoft Platform SDK.
Wininet.h
Windows CE Internet API errors are returned when something causes a failure in Internet functionality, such as an incorrect InternetURL property. Wininet.h is included with the Platform SDK. INTERNET_ERROR_BASE is defined as 12000 in wininet.h. When you receive an HRESULT along with a Native Error that suggests a failure in Internet functionality, you can determine the description of the HRESULT by converting the last four digits of the HRESULT from hexadecimal format to decimal format.
For example:
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28037
HR: 80072EFD
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
In this case, the user's device has no network connectivity. SQL Server CE Books Online shows the following description for Native Error 28037:
28037: HttpSendRequest failed; HRESULT has more detail
Because this appears to be an Internet error, start with wininet.h to find the description of the HRESULT. Convert the last four digits of the HRESULT from hexadecimal format (2EFD) to decimal format (12029). (To do this, you can use the Scientific Calculator included with Windows.) Because 12029 is in the wininet error range, search wininet.h for 12000, which returns the following line:
#define INTERNET_ERROR_BASE 12000
Because 12000 is defined as INTERNET_ERROR_BASE, search wininet.h for INTERNET_ERROR_BASE + 29 (12029). The HRESULT is defined as ERROR_INTERNET_CANNOT_CONNECT.
OLEDBerr.h
OLE DB HRESULTs can be returned from the SQL Server merge replication process or from SQL Server CE. These errors are in the hexadecimal range 0x80040EFF through 0x80040E9A. A comment corresponds to each HRESULT. For example:
//
// MessageId: DB_E_ERRORSINCOMMAND
//
// MessageText:
//
// The command contained one or more errors
//
#define DB_E_ERRORSINCOMMAND ((HRESULT)0x80040E14L)
Parameters
Parameters are generated at run time and return specific information about the cause of an error. The first three parameters of an error (P0, P1, and P2) are integers, while the last three parameters (P3, P4, and P5) are strings. For example, if your application cannot create a table because the table already exists, an error is added to the errors collection and a parameter may be generated with the name of the table.
Error Handling in an eVB Application
The following subroutine, ShowErrors(), illustrates how to handle errors in an eVB application. The routine displays the source, the HRESULT, and the Native Error (along with a description, if available) in a message box. SQL Server CE errors do not include text descriptions.
Sub ShowErrors(ErrColl As SSCEErrors)
Dim ErrRec As Object 'SSCE.ErrorRecords
Dim param As Object
Dim strErr As String
strErr = ""
For Each ErrRec In ErrColl
strErr = strErr & "Source: " & ErrRec.Source & vbCrLf
strErr = strErr & "Native Error: " & ErrRec.NativeError & vbCrLf
strErr = strErr & "HR: " & Hex(ErrRec.Number) & vbCrLf
strErr = strErr & "Description: " & ErrRec.Description & vbCrLf
For Each param In ErrRec.Params
strErr = strErr & "Param" & " = " & param.Param & vbCrLf
Next param
strErr = strErr & vbCrLf
MsgBox strErr, vbOKOnly
Next ErrRec
Set ErrRec = Nothing
Set param = Nothing
End Sub
To use ShowErrors(), check for errors in the collection after each SQL Server CE method call. The following example illustrates the calls to the Initialize(), Run(), and Terminate() methods of the SQL Server CE Replication object with checks for ErrorRecords. In the following example, the SetProperties() stub represents a function that sets the required replication properties.
Public repl as SSCE.Replication
SetProperties() 'stub for setting the replication properties.
Sub Merge()
If repl.ErrorRecords.Count > 0 Then
ShowErrors repl.ErrorRecords
Else
repl.Initialize
If repl.ErrorRecords.Count > 0 Then
ShowErrors repl.ErrorRecords
Else
repl.Run
If repl.ErrorRecords.Count > 0 Then
ShowErrors repl.ErrorRecords
Else
repl.Terminate
End If
End If
End If
End Sub
Error Handling in an eVC Application
The following eVC example displays replication, RDA, and Engine object errors.
Note You must include ca_mergex.h and link to ca_mergex.lib.
#define INC_OLE2
#define INITGUID
#include <windows.h>
#include <ole2.h>
#include <stdio.h>
#include "ca_mergex.h"
void ShowErrors(ISSCEErrors* pISSCEErrors)
{
HRESULT hr;
LONG cbBuf;
LONG i;
LONG lErrorCount;
LONG lErrorIndex;
LONG lParamCount;
LONG lParamIndex;
VARIANT var;
VARIANT varParam;
WCHAR wszBuff[4096];
WCHAR* pwszBuffPos = &wszBuff[0];
BSTR bstr;
ISSCEError* pISSCEError = NULL;
ISSCEParams* pISSCEParams = NULL;
ISSCEParam* pISSCEParam = NULL;
BOOL fSuccess = FALSE;
// Initialize variants
VariantInit(&var);
VariantInit(&varParam);
// Get count of errors
if(FAILED(hr = pISSCEErrors->get_Count(&lErrorCount))) goto Exit;
if (lErrorCount <= 0)
{
MessageBox(NULL, L"No extended error information.",L"ShowErrors",
MB_OK);
fSuccess = TRUE;
goto Exit;
}
// Display errors, one at a time
for (lErrorIndex = 0; lErrorIndex < lErrorCount; lErrorIndex++)
{
cbBuf = swprintf(pwszBuffPos, L"E R R O R %d of %d\r\n",
lErrorIndex+1, lErrorCount);
pwszBuffPos += cbBuf;
// Get next error record
var.vt = VT_I4;
var.lVal = lErrorIndex;
if(FAILED(hr = pISSCEErrors->get_Item(var, &pISSCEError))) goto Exit;
// Error Source
if (FAILED(hr = pISSCEError->get_Source(&bstr))) goto Exit;
cbBuf = swprintf(pwszBuffPos, L"SOURCE: '%s'\r\n", bstr);
pwszBuffPos += cbBuf;
SysFreeString(bstr);
// Native Error
if (FAILED(hr = pISSCEError->get_NativeError(&i))) goto Exit;
cbBuf = swprintf(pwszBuffPos, L"NATIVE ERROR: %d\r\n", i);
pwszBuffPos += cbBuf;
// Error Number (HR)
if (FAILED(hr = pISSCEError->get_Number(&i))) goto Exit;
cbBuf = swprintf(pwszBuffPos, L"HR: %8.8X\r\n", i);
pwszBuffPos += cbBuf;
// Error Description
if (FAILED(hr = pISSCEError->get_Description(&bstr))) goto Exit;
cbBuf = swprintf(pwszBuffPos, L"DESCRIPTION: '%s'\r\n", bstr);
pwszBuffPos += cbBuf;
SysFreeString(bstr);
// Retrieve the Error Parameters
if (FAILED(hr = pISSCEError->get_Params(&pISSCEParams))) goto Exit;
// Get the number of Error Parameters
if (FAILED(hr = pISSCEParams->get_Count(&lParamCount))) goto Exit;
// Display the Value of Each Parameter
for (lParamIndex = 0; lParamIndex < lParamCount; lParamIndex++)
{
// Get the parameter object
var.vt = VT_I4;
var.lVal = lParamIndex;
if (FAILED(hr = pISSCEParams->get_Item(var, &pISSCEParam)))
goto Exit;
// Get and display the parameter value
if (FAILED(hr = pISSCEParam->get_Param(&varParam))) goto Exit;
if (VT_I4 == varParam.vt || VT_UI4 == varParam.vt)
{
cbBuf = swprintf(pwszBuffPos, L"P%d: %d\r\n",
lParamIndex, (LONG) varParam.lVal);
}
else if (VT_I2 == varParam.vt || VT_UI2 == varParam.vt)
{
cbBuf = swprintf(pwszBuffPos, L"P%d: %d\r\n",
lParamIndex, (LONG) varParam.iVal);
}
else if (VT_BSTR == varParam.vt)
{
cbBuf = swprintf(pwszBuffPos, L"P%d: '%s'\r\n",
lParamIndex, varParam.bstrVal);
}
pwszBuffPos += cbBuf;
// Clear variant
VariantClear(&varParam);
// Release the parameter object
pISSCEParam->Release();
pISSCEParam = NULL;
}
cbBuf = swprintf(pwszBuffPos, L"\r\n");
pwszBuffPos += cbBuf;
// Display error information
//NOTE: The messagebox has been moved within the scope of the
FOR loop.
// The Books Online code displays all errors within the same
message box.
MessageBox(NULL, wszBuff,L"Error", MB_OK);
}
fSuccess = TRUE;
Exit:
// Release the parameter object
if (pISSCEParam)
{
pISSCEParam->Release();
pISSCEParam = NULL;
}
// Release the parameters object
if (pISSCEParams)
{
pISSCEParams->Release();
pISSCEParams = NULL;
}
// Release the error object
if (pISSCEError)
{
pISSCEError->Release();
pISSCEError = NULL;
}
// Errors object is released in calling routine
if (!fSuccess)
{
MessageBox(NULL, L"Error while processing errors!",L"ShowErrors",
MB_OK);
}
return;
}
SQL Server CE Server Agent Logging
SQL Server CE Server Agent is capable of logging errors, warnings, and informational messages to a log file on the IIS server. By default, logging is disabled. When logging is enabled, the log file sscerepl.log is written to the SQL Server CE IIS virtual directory. The information recorded in the log can be useful when trying to diagnose RDA or replication problems.
To enable SQL Server CE Server Agent logging
- Under the
HKLM\Software\Microsoft\MSSQLSERVERCE\Transport key, create a DWORD value. The name of the key value must begin with the local path associated with your SQL Server CE IIS virtual directory. For example, if your Sscesa10.dll is located in the Windows NT® file system (NTFS) file directory C:\Inetpub\sqlce\NorthWind, you must name the registry value C:\Inetpub\sqlce\NorthWind\LOGGING_LEVEL. The data value of the DWORD key must be a value between 0 and 3. For more information about these values, see the following table. - Restart IIS. This is essential because SQL Server CE Server Agent reads the registry key only when the SQL Server CE Server Agent DLL is first loaded by IIS. If you are running IIS 5.0 on Windows 2000, you can restart IIS through Internet Service Manager by right-clicking the server name and selecting Restart IIS. If you are running IIS 4.0 on Windows NT 4.0, you must restart the computer.
- Ensure that IIS is active and that your World Wide Web service is started.
The data value contained in the registry entry controls the level of logging that the SQL Server CE Server Agent performs. The following table describes the data values that you can assign to the registry key value.
| LOGGING_LEVEL value | Meaning |
| 0 | Logging is disabled. |
| 1 | Log errors. |
| 2 | Log errors and warnings. |
| 3 | Log errors, warnings, and informational messages.
Note SQL Server CE Server Agent generates very large log files when you specify LOGGING_LEVEL 3. You should not use this logging level under normal circumstances; however, it is useful when you are attempting to diagnose a problem. |
For example, if your SSCESA10.dll is located in the NTFS file directory C:\Inetpub\SSCE\NorthWind, create the following registry key value. In this example, the key value 3 causes logging of errors, warnings, and informational messages.
HKLM\Software\Microsoft\MSSQLSERVERCE\Transport
C:\Inetpub\sqlce\NorthWind\LOGGING_LEVEL 3
SSCEREPL.LOG description
The SQL Server CE Server Agent log file contains information about each replication merge, RDA Push or Pull, and SubmitSQL. To accommodate this information, the SSCEREPL.log file uses several abbreviations to shorten the length of the file.
Note The SSCEREPL.log file format may change in future versions.
Here are additional details about the meaning of the SQL Server CE Server Agent log acronyms and abbreviations:
- Replication Control Session Block (RSCB)
An RSCB is an automatically incremented structure used to keep the state of each message or operation. Each time IIS loads SSCESA10.dll, the RSCB begins at 1. - Command
The following describes the commands executed in the operation.
- OPNW—Open Write (no close)
- OPWC—Open Write Close
- OPNR—Open Read
- PUT—Put (write) data to the file on the server
- FTCH—Fetch (read) data from the file on the server
- CLOS—Close the file on the server
- SYNC—Synchronize (reconcile the data between the Subscriber and the Publisher)
- SCHK—Synchronize check, poll for the completion of the Synchronize operation
- PULL—RDA Pull operation
- PUSH—RDA Push operation
- SQL RDA—SubmitSQL() operation
- Thread
Indicates the ordinal of the active thread. - HRESULT (HR)
The HR for the particular command. For example, an HR of 0 is success.
SQL Server CE Server Agent logging example
In the following example, the Logging_Level value of SQL Server CE Server Agent is set to 3, the highest logging level.
2001/08/13 15:27:32 Thread=0 RSCB=1 Command=OPWC Hr=00000000
Total Compressed bytes in = 218
2001/08/13 15:27:32 Thread=0 RSCB=1 Command=OPWC Hr=00000000
Total Uncompressed bytes in = 332
2001/08/13 15:27:32 Thread=0 RSCB=1 Command=OPWC Hr=00000000
Responding to OpenWrite, total bytes = 218
2001/08/13 15:27:32 Thread=0 RSCB=1 Command=OPWC Hr=00000000
C:\school\D29F9B00-240B-11C1-8000-D7BB2DC4EF8D 0
2001/08/13 15:27:33 Thread=1000 RSCB=1 Command=SYNC Hr=00000000
Sync thread assigned = 1000
2001/08/13 15:27:33 Thread=1000 RSCB=1 Command=SYNC Hr=00000000
Synchronize entered 0
2001/08/13 15:27:33 Thread=1000 RSCB=1 Command=SYNC Hr=00000000
Synchronize responding 0
2001/08/13 15:27:34 Thread=1 RSCB=1 Command=SCHK Hr=00000001
SyncCheck responding 0
2001/08/13 15:27:36 Thread=2 RSCB=1 Command=SCHK Hr=00000000
SyncCheck responding 0
2001/08/13 15:27:36 Thread=3 RSCB=1 Command=OPNR Hr=00000000
Responding to Fetch, bytes = 32752
2001/08/13 15:27:37 Thread=4 RSCB=1 Command=FTCH Hr=00000000
End Of Data Set 1
2001/08/13 15:27:37 Thread=4 RSCB=1 Command=FTCH Hr=00000000
Responding to Fetch, bytes = 15232
2001/08/13 15:27:37 Thread=0 RSCB=1 Command=CLOS Hr=00000000
Total Compressed bytes out = 47984
2001/08/13 15:27:37 Thread=0 RSCB=1 Command=CLOS Hr=00000000
Total Uncompressed bytes out = 90203
2001/08/13 15:27:37 Thread=0 RSCB=1 Command=CLOS Hr=00000000
Removing this RSCB 0
2001/08/13 15:43:26 Hr=00000000 Count of active RSCBs = 0
<STATS Period_Start="2001/08/13 15:27:32" Period_Duration="954"
Syncs="1" SubmitSQLs="0" RDAPushes="0" RDAPulls="0"
AVG_IN_File_Size="332" AVG_OUT_File_Size="90203"
Completed_Operations="1" Incomplete_Operations="0"
Total_Sync_Thread_Time="3" Total_Pool_Thread_Time_IN="0"
Total_Pool_Thread_Time_OUT="0" Total_Sync_Queue_Time="0"
Total_Pool_Queue_Time_IN="0" Total_Pool_Queue_Time_OUT="0" />
The following is a detailed description of several lines of code from the previous example. In this line, the Server Agent opens, writes, and closes a message file of 218 compressed bytes.
2001/08/13 15:27:32 Thread=0 RSCB=1 Command=OPWC Hr=00000000
Total Compressed bytes in = 218
In the next line, the name of the message file is shown (c:\school\D29F9B00-240B….). This name does not include the .in and .out extensions used by SQL Server CE Server Agent.
2001/08/13 15:27:32 Thread=0 RSCB=1 Command=OPWC Hr=00000000
C:\school\D29F9B00-240B-11C1-8000-D7BB2DC4EF8D 0
The following line describes the ordinal of the active sync thread in addition to the SYNC command.
2001/08/13 15:27:33 Thread=1000 RSCB=1 Command=SYNC Hr=00000000 Sync thread assigned = 1000
In the next line, SQL Server CE Server Agent checks to determine whether the synchronization is complete. SQL Server Replication Agent has reconciled the client's changes and has created an .out file.
2001/08/13 15:27:34 Thread=1 RSCB=1 Command=SCHK Hr=00000001
SyncCheck responding 0
The next step is to retrieve any changes that occurred on the server. This line reports the number of bytes from the server.
2001/08/13 15:27:36 Thread=3 RSCB=1 Command=OPNR Hr=00000000
Responding to Fetch, bytes = 32752
Finally, the file is closed.
2001/08/13 15:27:37 Thread=0 RSCB=1 Command=CLOS Hr=00000000
Total Compressed bytes out = 47984
SQL Server CE Server Agent statistics
The <STATS> tag reports the SQL Server CE connectivity operations that occurred over the last 15 minutes. This report is generated whenever an active request (RCSB) recognizes that 15 minutes have passed since the last report was generated. At times of low volume, this report may be generated less often. (It is generated only when an active request occurs). The statistics report is useful in determining performance issues.
The following statistical report shows a single synchronization (merge replication).
<STATS Period_Start="2001/08/13 15:27:32" Period_Duration="954"
Syncs="1" SubmitSQLs="0" RDAPushes="0" RDAPulls="0"
AVG_IN_File_Size="332" AVG_OUT_File_Size="90203"
Completed_Operations="1" Incomplete_Operations="0"
Total_Sync_Thread_Time="3" Total_Pool_Thread_Time_IN="0"
Total_Pool_Thread_Time_OUT="0" Total_Sync_Queue_Time="0"
Total_Pool_Queue_Time_IN="0" Total_Pool_Queue_Time_OUT="0" />
Definitions of SQL Server CE Server Agent log statistics
This section defines SQL Server CE Server Agent log attributes. Knowing how to interpret these results is important when researching errors and performance issues.
| Attribute | Description |
| Period_Start | Start of the STATS period (in longdate format). |
| Period_Duration | Time that this report covers (in seconds). |
| Syncs | Number of bidirectional replication merges performed during this report period. |
| SubmitSQLs | Number of RDA SubmitSQL() calls during this report period. |
| RDAPushes | Number of RDA Push() calls during this report period. |
| RDAPulls | Number of RDA Pull() calls during this report period. |
| AVG_IN_File_Size | Average size of the .in files (in bytes). Files with an .in extension are physical files created from the message data sent by the client. |
| AVG_OUT_File_Size | Average size of the .out files (in bytes). Files with an .out extension are physical files created from the message data sent from the server. |
| Completed_Operations | Number of Syncs, SubmitSQLs, RDAPushes, and RDAPulls that were completed during this time period. |
| Incomplete_Operations | Number of Syncs, SubmitSQLs, RDAPushes, and RDAPulls that started but were not completed during this time period. |
| Total_Sync_Thread_Time | Time that all Sync threads took to complete synchronization operations (in seconds). Sync threads are members of a pool of threads that process messages from SQL Server CE. This statistic does not include the time it took to transfer the messages to and from the SQL Server CE clients. |
| Total_Pool_Thread_Time_IN | Time required to send all data to the server (in seconds). Comparing this attribute to Total_Pool_Thread_Time_OUT reveals where the greatest amount of time is spent, either sending data to the server or sending data to the device. |
| Total_Sync_Queue_Time | Time that sync requests wait in the sync queue before being processed by the server (in seconds). |
| Total_Pool_Queue_Time_IN | Time that messages from clients wait in the queue before being processed by the SQL Server CE Server Agent (in seconds). |
| Total_Pool_Queue_Time_OUT | Time that messages from SQL Server wait before being processed by the SQL Server CE Server Agent (in seconds). |
By comparing these statistics, you can evaluate which processes require the most time to run. For example, a scenario using replication in which the only updates occur at the Subscriber should produce higher numbers for Total_Pool_Thread_Time_IN and AVG_IN_File_Size, but lower numbers for Total_Pool_Thread_Time_OUT and AVG_OUT_File_Size.
General Connectivity Issues
RDA and replication functionality have some common errors.
Note The definition of the HRESULT is included in the following examples. This is not returned at run time.
Incorrect InternetURL property
The following error is returned when the InternetURL property is incorrect for the following reasons:
- The virtual directory is incorrect. For example: http://server/sssce/sscesa10.dll where http://server/ssce/sscesa10.dll is the proper URL.
- The string sscesa10.dll is missing from the URL. For example: http://server/share
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28017
HR: 80004005 (E_FAIL)
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
To correct this error, correct the URL in the InternetURL property. You can do this by attempting using Microsoft Pocket Internet Explorer to verify the InternetURL property.
No network connectivity
This error is returned when the device has no connectivity option. For example, if the device does not have a working modem, network card, or universal serial bus (USB) connection.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28037
HR: 80072EFD
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
To correct this error, make sure your modem, network card, or USB connection is working. You can do this by using Pocket Internet Explorer to verify the InternetURL property. Place the value of the InternetURL property into the address bar of Pocket Internet Explorer. The word "body" will be displayed in the Pocket Internet Explorer window if the InternetURL property is correct.
Note This error may also be returned when the IIS server is unavailable or if the ISP or network is not functioning properly.
Troubleshooting Replication Issues
The following is a list of issues you may encounter when using replication with SQL Server CE.
Connectivity: SSCERP10.dll Not Registered
The DLL SSCERP10.dll must be registered on the IIS server. If the SQL Server CE replication provider is not registered, the following errors are returned to the Run() method.
Source: Microsoft SQL Server CE Edition
Native Error: 29045
HR: 8004505B
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Merge Process
HR: 8004505B
Native Error: 0
Description: The merge process could not load the Merge Replication Provider for 'SSCE'. Check to see that the component is registered correctly.
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
To correct this error, register SSCERP10.dll on the IIS server and restart IIS.
Schema: Indexes on ANSI Columns Greater than 255
SQL Server CE does not support ANSI data types. All ANSI data types are mapped to Unicode. String data types (char, text, varchar) with a character count greater than 255 are mapped to NTEXT. SQL Server CE does not support indexes on NTEXT or image columns. The following errors are returned to the Run() method when attempting to subscribe to a publication that includes an indexed string column with a character count greater than 255.
For a complete list of unsupported data types, see the SQL Server CE Books Online topic "Mapped Data Types."
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28557
HR: 80004005
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28560
HR: 80040E21
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 25059
HR: 80040E21
Description: Errors occurred.
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
It is important that you step through all of the errors in the collection, because the last error provides the reason for this failure.
To correct this error, remove any indexes on ANSI columns that are greater than 255 characters in size, or reduce the size of the columns to fewer than 255 characters.
Schema: Identity on Int Columns with a Size Other Than 4
SQL Server CE only supports the Identity property on Int(4) columns. SQL Server 2000 supports the Identity property on Bigint, Smallint, and Tinyint data types.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28557
HR: 80004005
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28560: OLE DB Execute Method failed; bad or invalid SQL statement.
HR: 80040E14
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 25551:
HR: 80040E21
Description: Errors occurred.
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
To correct this error, change your Identity columns to the Int(4) data type.
Schema: Non-Character Mode Snapshots
SQL Server CE does not support BCP-mode snapshots. Such snapshots can be delivered if the publication is not created by choosing SQL Server CE Subscribers in the Create Publication Wizard in SQL Server Enterprise Manager.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28557
HR: 80004005
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28560
HR: 80040E14
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 25501
HR: 80040E14
Description: The command contained one or more errors.
Param = 1
Param = 1
Param = 0
Param = SET
Param =
Param =
Note In this case, the last error includes a parameter from the failed query, SET.
To correct this error, republish, choosing SQL Server CE in the Create Publication Wizard or Character as the @sync_mode property of the sp_addmergepublication stored procedure.
Schema: Violation of Referential Integrity
SQL Server CE handles most referential integrity violations by reattempting to apply the row. If the row sent from the SQL Server CE Subscriber cannot be applied at the SQL Server Publisher, the following error is returned. This error is usually caused by the violation of a self-reference on a table.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 28549
HR: 80040E2F
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
To correct this error, remove the violation by updating or deleting the row that violates integrity at the Subscriber.
Unsupported SQL Server Replication Features
While a SQL Server CE database can be a subscriber to a SQL Server 2000 publication, some features are not supported.
Alternate snapshot locations
This feature allows you to store the publication snapshot in a new folder or in a folder separate from the default location. SQL Server CE does not support this feature.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 29006
HR: 80004005
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Merge Replication Provider
Native Error: 0
HR: 80045017
Description: The process could not deliver the snapshot to the Subscriber.
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
If you need to move a snapshot folder, you can do so using SQL Server Enterprise Manager, as follows:
- On the Enterprise Manager menu, click Tools, point to Replication, and then click Configure Publishing, Subscribers, and Distribution….This opens the Publisher and Distributor Properties dialog box. (See Figure 1.)
Figure 1. Publisher and Distributor Properties window
- Click the Publishers tab, click the properties […] button, and choose your Publisher from the list of servers. (See Figure 2.)
Figure 2. Publishers tab
- In the Snapshot folder text box, type the path to your snapshot folder as a Uniform Naming Convention (UNC) path, or search for the path by clicking the […] button, and then click OK. (See Figure 3.)
Figure 3. General tab
- Rerun the Snapshot Agent to create a new snapshot in the new location.
Mapped data types
SQL Server CE supports Unicode data types only and converts all ANSI character data types to their Unicode equivalents. For example, if you subscribe to a table with a Char column of 256 characters, that table is mapped to a SQL Server CE NTEXT column. If a user inserts a record into this column that has a value larger than 256 characters, an error is returned, because the data cannot fit into the Char column at the Publisher.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 29006
HR: 80004005
Description: Run
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Merge Replication Provider
Native Error: 0
HR: 80045020
Description: The process could not log conflict information.
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: <SQL Server Name>
Native Error: 0
HR: 0
Description: {call [sp_cft_2619F21C121FDC1354371623E7942E5] (?,?, ?,? ,? ,? ,? , ?)}
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Note This description contains the name of an internal SQL Server replication stored procedure. The name varies.
Source: <SQL Server Name>
Native Error: 0
HR: 0
Description: String data, right truncation.
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
To correct this error, if you cannot change the schema of the Publisher to avoid this type of data type mapping, add application–level logic to limit the number of characters that users can enter on their devices.
Troubleshooting RDA Issues
You may encounter the following issues when you use RDA with SQL Server CE.
Duplicate Key Values
When inserting records into a table created through a RDA Pull(), many users experience duplicate key violations. One reason for this is Identity columns. SQL Server CE RDA does not set the seed on the Identity columns when a table is pulled.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 25016
HR: DB_E_INTEGRITYVIOLATION
Description: Value violated the integrity constraints for a column or table.
Interface defining error: IID_IRowsetChange
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
This error can be returned when the user attempts to insert a row with an automatically incremented Identity column. With RDA, this usually occurs when a user pulls rows from the server and attempts to insert new rows before setting the seed and increment values for the Identity column. By default, the seed and increment values are both 1.
To correct this error, set the seed to the next highest number after the table is pulled, before allowing users to enter data.
Invalid or nonexistent SQL Server database
In some cases, when SQL Server cannot connect to a database on a server, the error returned indicates that the login failed. SQL Server attempts to log in and gain permission to the database before it attempts to open it. Note that the second error in the collection returns no parameters and the third returns a native error from the SQL Server OLE DB provider.
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 0
HR: 80004005
Description: Pull
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server 2000 Windows CE Edition
Native Error: 0
HR: 80004005
Description: Unspecified Error
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
Source: Microsoft SQL Server OLE DB Provider for SQL Server
Native Error: 4060
HR: 80004005
Description: Cannot open database requested in login '<initial catalog parameter passed as part of PULL() method's OLEDBConnectionString>'. Login fails
Param = 0
Param = 0
Param = 0
Param =
Param =
Param =
To correct this error, verify that you have the passed the correct user id, password, and Initial Catalog to the OLEDBConnectionString parameter of your Pull method.
Conclusion
SQL Server CE includes a number of methods to troubleshoot errors and performance issues. Using the errors collection properly, you can determine the root cause of failures and resolve them. You can also use the SQL Server CE Server Agent log to obtain performance and historical information, helpful in diagnosing issues. While some errors seem cryptic, stepping through the entire errors collection and researching the HRESULT with the native error will yield the information required to resolve the issue.
References
SQL Server CE Books Online
Microsoft Product Support Services Knowledge Base article, Q273580: HowTo: Look up Error Codes Related to SQL Server CE.
The information contained in this document represents the current view of Microsoft Corporation on the issues discussed as of the date of publication. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information presented after the date of publication.
This White Paper is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation.
Microsoft may have patents, patent applications, trademarks, copyrights, or other intellectual property rights covering subject matter in this document. Except as expressly provided in any written license agreement from Microsoft, the furnishing of this document does not give you any license to these patents, trademarks, copyrights, or other intellectual property.
© 2001 Microsoft Corporation. All rights reserved.
Microsoft, ActiveX, Visual Basic, Visual C++, Windows, and Windows NT are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.
The names of actual companies and products mentioned herein may be the trademarks of their respective owners.