SQLServer JDBC Exceptions :Controlling Exceptions Text Format

Hi,

Using RAISERROR from within a stored prcedure will result in a SQLException being thrown at the client side of a JDBC connection.
I am trying to provide a meaningfull error message to be shown to the end user. However, all exceptions thrown will inevitably start with : "[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]". The following questions then arise :

- Is there a way of configuring SQL Server not to display this header ?

alternatively,

- Is there another way of conveying error messages to the client through JDBC ?

Thank you for your answers,
Ben

[684 byte] By [BenDave] at [2007-12-24]
# 1

Hi Ben,

Sorry for the delay in replying to this post. I strongly believe that it is the 2000 JDBC driver that is internally appending this string to all exceptions received from the server. With that said, I would recommend that you use the Microsoft SQL Server 2005 JDBC driver v1.1 which can be found at: http://msdn.microsoft.com/data/ref/jdbc/. This newer driver is still compatible with SQL Server 2000 and will not contain any prefixed server messages. The RAISEERROR function is the preferred, if not only, method of triggering exceptions to clients.

I hope you download the 2005 driver and continue to provide feedback on your experience.

Thanks,

Jaaved Mohammed

JaavedMohammed-MSFT at 2007-10-8 > top of Msdn Tech,SQL Server,SQL Server Data Access...

SQL Server

Site Classified