Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
BlueDragon Self-Help: FAQ
Back to Search >  Back to Search Results

Faq ID 239
Product JTurbo
Category CallableStatement, PreparedStatement, Statement
Question I'm receiving unexpected or more-than-expected update counts. Why is this happening and what can be done to fix it ?
Answer If the SQL you are sending to the database via JTurbo is causing database triggers to execute then you should be aware that certain triggers may produce their own update counts which JTurbo will receive and make available to your code via the Statement interface (implemented by JTurbo's Statement, PreparedStatement, or CallableStatement objects).
You can either write your code to handle these update counts properly, or you could modify the SQL of your triggers so that any update counts that they generate will be suppressed. This could be done in the following manner:
At the beginning of your trigger(s) add the statement:
SET NOCOUNT ON

Also note that Query Analyzer does not report these extra, possibly unwanted update counts. This is because when you send the SQL from query analyzer it is sent as a regular statement... not a PreparedStatement or a CallableStatement. Regular statement rowcounts are returned differently than are trigger rowcounts but PreparedStatement rowcounts and CallableStatement rowcounts are NOT returned differently than are trigger rowcounts. That's why query analyzer is able to ignore the trigger rowcounts. JTurbo could potentially be made to ignore such update counts IF a regular Statement is used, but not if a PreparedStatement or CallableStatement were used. For this reason JTurbo does not attempt to ignore these counts (even if you use a regular Statement). The prefered way to fix this is to modify the SQL in your trigger as mentioned above since some customers may desire these update counts while others may not.



   
company media information terms of use privacy policy contact us