Closing objects when not in use
When you work with closable objects of Microsoft JDBC Driver for SQL Server, you should explicitly close them by using their close methods when they're no longer needed. This pattern particularly applies to SQLServerResultSet and the Statement objects like SQLServerStatement, SQLServerPreparedStatement, and SQLServerCallableStatement. Closing improves performance by freeing up driver and server resources quickly, instead of waiting for the Java Virtual Machine garbage collector to do it for you.
Closing objects is crucial to maintaining good concurrency on the server when you're using scroll locks. Scroll locks in the last accessed fetch buffer are held until the result set is closed. Similarly, statement prepared handles are held until the statement is closed. If you're reusing a connection for multiple statements, closing statements before they go out of scope allows the server to clean up the prepared handles earlier.
See also
משוב
https://aka.ms/ContentUserFeedback.
בקרוב: במהלך 2024, נפתור בעיות GitHub כמנגנון המשוב לתוכן ונחליף אותו במערכת משוב חדשה. לקבלת מידע נוסף, ראה:שלח והצג משוב עבור