locked
java with jdbc 2.0 and Mircosoft sql server 2008 (Resultset and error) RRS feed

  • Question

  • hi,

    i call in java a stored procedure in a sql server 2008 and get a resultset (for example 11 rows).
    I call the same procedure with sql server management studio 2008 and get the resultset (11rows), but also in a second tab a error that in row 12 a string was too long.
    I need also this Error in java, to check if the resultset is complete (50 rows instead 11 rows).
    How can i get the Error, the warningsstring of the resultset is empty.

    edit: the sql exception has not been thrown.

    Greets ph0e
    • Edited by ph0e Friday, June 19, 2009 6:45 AM
    Friday, June 19, 2009 6:42 AM

All replies

  • Hi ph0e,

    Does your application read the ResultSet rows?  The JDBC driver should throw an SQLException when the application hits the row with the error in it.

    Regards,
    --David Olix [SQL Server]
    • Proposed as answer by David Olix - MSFT Friday, June 19, 2009 9:28 PM
    • Unproposed as answer by ph0e Monday, June 22, 2009 8:24 AM
    Friday, June 19, 2009 9:28 PM
  • Hi David,

    i get a correct resultset with 11 rows, no exception, the are no more rows.
    The 11 rows have been correctly read.
    In Managementstudio the same, a resultset with 11 rows and a exception in a extra tab.
    I think it is a new feature of sql server 2008? But it is a problem.

    Greets ph0e
    Monday, June 22, 2009 6:24 AM
  • Hi ph0e,

    If the error is really on the 12th row, ResultSet.next() should throw an SQLException when trying to move from the 11th row to the 12th row.  If the application only scrolls through 11 rows, no exception will be thrown.

    Could you post a sample stored procedure and sample application code here that demonstrates your issue?  Alernately, you may want to open a case with Microsoft Customer Support to investigate further.

    Regards,
    --David Olix [SQL Server]
    Tuesday, June 23, 2009 9:01 PM