-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QUESTION] Suppressed IOException/SQLServerException when using ResultSet.getClob(...) #1561
Comments
Hi @dru1 , Thank you for bringing this up. If I understand it correctly, the suppressed exceptions start showing up since 7.4.1jre8 and existing in all the following versions, right? We will test it locally with your test project and see why this change of behavior happens. Thanks, |
Hi @karinazhou, maybe the suppressed exceptions show up in an earlier version too. I've just tried the version Thanks |
Hi @dru1 , Some updates on this issue. After testing your repo application, the exception starts shown up in version Thanks, |
@dru1 In your test application, when reading the stream from the resultSet object, the active stream from The try block with BufferedReader in the However, this is not supposed to happen while the SQLServerClob object is still active. After version 6.2.2, we change the logic in the driver how we handle LOB streaming. The driver keeps activeStreams throughout the lifecycle of SQLServerClob object. When the
If you avoid using the BufferedReader in
Please feel free to give it a try and see how it works. Thanks, |
Hello @karinazhou, thank you very much for your detailed analysis. I can confirm that if the Unfortunately, the documentation of And even if it is safe to avoid the close() call, it wouldn't help us much since the What do you think about this? |
Hi @dru1 , Good opinions regarding this topic. I agree that our documentation doesn't illustrate the behavior when There were some discussions back in 2017 about giving access to the InputStream even after the resultSet or the statement is closed. This design is to avoid loading entire data into memory for large content (#673 / #567 / #697 ). When LOB objects are closed, these InputStreams will be closed too. See the So the InputStreams will be closed properly. I am not quite familiar with how the Hibernate ORM framework deals with LOB objects but I think it needs to avoid closing the InputStreams before the LOB objects are closed. |
Hi @dru1 , We are closing this issue due to no actions required. Please feel free to request us to reopen it if needed. Thanks! |
Question
After updating the mssql-jdbc driver from version
6.2.2.jre8
to7.4.1jre8
for our company application, we have noticed an increased number of suppressedIOException
s andSQLServerException
s. This behavior appears to be caused within the driver whenjava.sql.ResultSet.getClob()
is called.Our company application uses Hibernate
5.4.10.Final
for data access and some of our entities use an@Lob
mapping pointing toNVARCHAR(max)
columns in the database. Whenever such entities are loaded from the database, Hibernate callsjava.sql.ResultSet.getClob()
at some point, resulting in these suppressed exceptions.From the application's point of view, there are no visible errors because these exceptions are suppressed, but there is a performance loss for data access due to throwing and suppressing exceptions. This performance loss has been confirmed with profiling software. Is there a specific reason why this is happening? Did we miss something in the driver configuration?
We tested this behavior with Java 8 on Windows 10 with SQL Server 2014 and 2019 using driver versions
9.2.1jre8
and7.4.1jre8
. To confirm this behavior, we also created a test project to try different driver versions.The test project can be found here:
https://github.com/dru1/mssql-jdbc-clob-exception
The test project does not use Hibernate, just the driver itself and some JDBC code derived from this guide:
https://docs.microsoft.com/en-us/sql/connect/jdbc/step-3-proof-of-concept-connecting-to-sql-using-java?view=sql-server-ver15
The text was updated successfully, but these errors were encountered: