Article ID: 820773 - View products that this article applies to.
The Microsoft SQL Server 2000 Driver for JDBC does not close server cursors that it opens under some conditions. This can cause cursor build up and memory pressure on Microsoft SQL Server. This can also cause server and application performance degradation, so that eventually clients can no longer connect to the SQL Server.
The following errors may be reported in the SQL Server error log:
Microsoft SQL Server may return the following error message to the client, but this message is generally not reported in the SQL Server error log:
2003-05-06 11:24:10.82 server Error: 17803, Severity: 20, State: 17
2003-05-06 11:24:10.82 server Insufficient memory available.
2003-05-06 11:25:26.94 spid395 BPool::Map: no remappable address found.
The driver leaks the server cursor when all the following conditions are true:
Error 701: There is insufficient system memory to run this query.
According to the JDBC specifications, when a statement is closed, the driver immediately releases the database of the object of that statement, and also releases the JDBC resources. However, because of a bug in the Microsoft SQL Server 2000 Driver for JDBC, when a statement is executed with the execute method, the driver only closes retrieved resultsets. This behavior implicitly closes the associated server cursor. If no resultset is retrieved, the server cursor is left open.
Method 1To resolve this issue, download and install SQL Server 2000 Driver for JDBC Service Pack 3 from the following Microsoft Web site:
Method 2A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next service pack that contains this hotfix.
To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=supportNote In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.
The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.
Note Although the file timestamp may be different for each operating system that is listed, internally the files are exactly the same. The best way to determine the version of the driver that you are using is to use the getDriverVersion method of the DatabaseMetaData interface.
The Windows version of this fix has the following properties: Date Time Version Size File name -------------------------------------------------------------- 05-May-2003 17:27 2.2.0034 286,788 Msbase.jar 05-May-2003 17:27 2.2.0034 67,159 Mssqlserver.jar 05-May-2003 17:27 2.2.0034 58,903 Msutil.jar The Unix-based version of this fix has the following properties: Date Time Version Size File name -------------------------------------------------------------- 05-May-2003 14:27 2.2.0034 286,788 Msbase.jar 05-May-2003 14:27 2.2.0034 67,159 Mssqlserver.jar 05-May-2003 14:27 2.2.0034 58,903 Msutil.jar
To install this hotfix, follow these steps:
To work around this problem use one of the following methods.
Note If your application uses any third-party components that may execute queries under the covers with the conditions that are mentioned in the "Symptoms" section of this article, use only the first method. Only the first method might work around the problem when you use these third-party components.
Method 1Use the default SelectMethod. When the SelectMethod = Cursor Connection property is not set, the driver always uses the SelectMethod = Direct option. The SelectMethod = Direct does not open any cursors on the server.
Method 2Use the executeQuery method instead of the execute method on the statement.
Method 3Return the resultset by using the getResultSet method on the statement after you execute the query. In this case, the Close method on the statement implicitly closes the resultset and the associated server cursor.
Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
You can use Performance Monitor to monitor the number of cursors that are opened in Microsoft SQL Server. To do this, use the SQL Server:Cache Manager performance object, and then select the Cache Object Counts counter and the Cursors instance. If this counter shows a steady increase in value up to the point of the out of memory condition, you might be experiencing the problem that is mentioned in the "Symptoms" section of this article.
Steps to reproduce the problem
Article ID: 820773 - Last Review: October 25, 2005 - Revision: 3.3