FIX: SQL Server 2000 Driver for JDBC leaks server cursors (820773)
The information in this article applies to:
- Microsoft SQL Server 2000 Driver for JDBC
SYMPTOMSThe 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: 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.
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: Error 701: There is insufficient system memory to run this
query. The driver leaks the server cursor when all the
following conditions are true:
- The connection is opened with SelectMethod = Cursor property set.
- The statement is executed with the execute method.
- No resultset is retrieved.
- The statement is closed.
CAUSE 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.RESOLUTIONMethod 1 To 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: Note 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.
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 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. To install this hotfix, follow these steps:
- Unzip the hotfix package to get three related files (msbase.jar, mssqlserver.jar and msutil.jar)
- Click Start, click Run type %programfiles%\Microsoft SQL Server 2000 Driver for JDBC\lib, and then click OK.
- Replace the following existing files in this folder with the files in the hotfix:
- msbase.jar
- mssqlserver.jar
- msutil.jar
WORKAROUNDTo 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.STATUS Microsoft
has confirmed that this is a problem in the Microsoft products that are listed
at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 10/25/2005 |
---|
Keywords: | kbHotfixServer kbQFE kbQFE KB820773 kbAudDeveloper |
---|
|