Tricky: java.lang.StackOverflowError due to recursive call in warning messages construction

From: Alexandre Delarge (alexandre.delarge_at_laposte.net.nospam)
Date: 09/01/04


Date: Wed, 1 Sep 2004 17:14:15 +0200

Greetings to readers,

I got this problem with both SP2 and SP3 of the JDBC driver for SQL Server
2000:

The recursive call made in method
"com.microsoft.jdbc.base.BaseWarnings.createSQLWarning()" causes a
java.lang.StackOverFlowError when number of warning messages (or PRINT sql
statements is too important).

To reproduce this problem, create a sql script which contains approximately
5 megabytes of PRINT statements within one unique transaction, e.g:

    -----
    SET NOCOUNT ON
    PRINT 'Begin'
    BEGIN TRANSACTION
    PRINT 'Hello !' -- repeat this statement the required number times to
reach a file size of 5mb
    COMMIT TRANSACTION
    -----

As PRINT statements are returned as warning messages, this will have the
same consequence as producing real warnings.

Run that script on your database using classic Java code, eg:

    statement.execute(loadedSqlScriptContent); // Send content of the sql
script to the server
    resultSet = statement.getResultSet(); // This will get a null object as
you update nothing
    SQLWarning warning = statement.getWarnings(); // Get print/warning
messages

The third line should cause a java.lang.StackOverFlowError as the number of
warning messages to construct is huge.

So I would have 2 questions:

- does anyone has any idea of how to solve this issue without simply
increasing the JVM stack size ? (you can keep suggestions like "don't
retrieve the warnings", etc. :).

- does anyone who I should contact to have this issue possibly fixed into
next JDBC driver's release ?

Any answer to any of these 2 questions would be just great.

Thanks a lot by advance.

Alexandre Delarge.



Relevant Pages

  • Re: Method cleanup failed while trying to execute method cleanup on ManagedConnection
    ... JDBC driver name: Microsoft SQL Server 2005 JDBC Driver ... Our application seems to be working fine but every time a connection is closed we get a stack trace in the log indicating that destroy failed and that a method is not supportd with "Caused by: java.sql.SQLException: This operation is not supported.DSRA0010E: SQL State ... We have used the same set up but using the SQL Server 2000 JDBC driver talking to a SQL Server 2000 database without a problem, the only difference is we switched it to use SQL Server 2005. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: Cannot connect to my SQL 2005 server using JDBC - can any dia
    ... associated with the named instance, instead of the name of the ... This seems to suggest that whatever version of the JDBC driver the article ... Cannot connect to my SQL 2005 server using JDBC - can any diagnostic tool tell me what the problem is? ... Running SQL Server 2005 SP2 and using named instances. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Method cleanup failed while trying to execute method cleanup on ManagedConnection
    ... JDBC driver name: Microsoft SQL Server 2005 JDBC Driver ... SQL State = null, Error Code = 0 ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Newlines not allowed in Call Escape by SQL Server 2005 JDBC driver
    ... If the stored procedure call SQL Escape syntax " ... The SQL Server 2000 JDBC driver does not exhibit ...
    (microsoft.public.sqlserver.jdbcdriver)
  • Re: Error Checking for Warning Messages
    ... If @iErr 0 ... I would like to test for warning messages such as: ... There is no way to capture this message in SQL Server, ... are you still on SQL 2000? ...
    (microsoft.public.sqlserver.programming)