Hi Venkat, Thanks for the feedback. I will still look into this issue with sqljdbc4. Coincidentally, another customer had a very similar issue here: - https://groups.google.com/forum/#!topic/jooq-user/USKicuWam68 - http://stackoverflow.com/q/21757191/521799
On our side, we're running integration tests with both sqljdbc4 and jTDS since version 3.1, so the JDBC driver switch should be fine on your side. Best Regards, Lukas 2014-02-13 15:01 GMT+01:00 Venkat Sadasivam <[email protected]>: > Lukas - jTDS driver does solve all our issues. Thanks for the heads up. > > > On Friday, 7 February 2014 08:53:01 UTC-5, Venkat Sadasivam wrote: >> >> Thanks Lukas for you analysis. We will try with jTDS and see it is can >> solve our issues. >> >> >> On Friday, 7 February 2014 05:25:03 UTC-5, Lukas Eder wrote: >>> >>> Some more background info. I'm using this procedure here: >>> >>> CREATE PROCEDURE p_raise(@mode int) >>> AS >>> BEGIN >>> IF @mode = 1 >>> BEGIN >>> RAISERROR('message 1', 16, 2, 3); >>> RAISERROR('message 2', 16, 2, 3); >>> END >>> ELSE >>> THROW 50000, 'message', 2; >>> END; >>> >>> >>> The following test runs with jTDS and fails with sqljdbc_4.0: >>> >>> @Test >>> public void testSQLServerRaiserror() throws Exception { >>> try { >>> Routines.pRaise(create().configuration(), 0); >>> fail(); >>> } >>> catch (DataAccessException e) { >>> SQLException cause = (SQLException) e.getCause(); >>> assertEquals("message", cause.getMessage()); >>> } >>> >>> try { >>> Routines.pRaise(create().configuration(), 1); >>> fail(); >>> } >>> catch (DataAccessException e) { >>> SQLException cause = (SQLException) e.getCause(); >>> assertEquals("message 1", cause.getMessage()); >>> >>> *cause = cause.getNextException();* >>> assertEquals("message 2", cause.getMessage()); >>> } >>> } >>> >>> >>> >>> 2014-02-07 11:21 GMT+01:00 Lukas Eder <[email protected]>: >>> >>>> Hmm, OK, I've misunderstood you, before. So, you're chaining errors in >>>> your T-SQL program, and you'd like to unload them all into JDBC, right? >>>> I wasn't aware of this JDBC feature. That is quite useful. >>>> >>>> After some investigation, I feel that the SQL Server JDBC driver might >>>> not be behaving correctly. All these errors should be chained in a single >>>> SQLException and made accessible through SQLException.getNextException(). >>>> This seems to be implemented correctly in jTDS as can be seen here: >>>> https://sourceforge.net/p/jtds/discussion/104388/thread/fadec845/ >>>> >>>> With jTDS, I can write: >>>> >>>> catch (SQLException e) { >>>> SQLException x = e; >>>> while (x != null) { >>>> System.out.println(x.getMessage()); >>>> x = x.getNextException(); >>>> } >>>> } >>>> >>>> The above works regardless if execute() or executeUpdate() is used. >>>> Could you maybe try your own test program with jTDS on your side? >>>> http://jtds.sourceforge.net/ >>>> >>>> Do you get the same erroneous behaviour? >>>> >>>> Regards, >>>> Lukas >>>> >>>> >>>> 2014-02-07 10:37 GMT+01:00 Lukas Eder <[email protected]>: >>>> >>>> Hi Venkat, >>>>> >>>>> Some update on this issue. jOOQ seems to work as expected when you use >>>>> SQL Server 2012's THROW instead of RAISERROR: >>>>> - http://msdn.microsoft.com/en-US/library/ee677615.aspx (THROW) >>>>> - http://msdn.microsoft.com/en-US/library/ms178592.aspx (RAISERROR) >>>>> >>>>> Note that the latter is deprecated by Microsoft. I'll still >>>>> investigate RAISERROR to support older versions of SQL Server >>>>> >>>>> Regards, >>>>> Lukas >>>>> >>>>> >>>>> 2014-02-06 19:21 GMT+01:00 Lukas Eder <[email protected]>: >>>>> >>>>> Hi Venkat, >>>>>> >>>>>> Thank you very much. This is very helpful. I'll investigate this >>>>>> tomorrow >>>>>> >>>>>> >>>>>> 2014-02-06 14:49 GMT+01:00 Venkat Sadasivam <[email protected]>: >>>>>> >>>>>> Hi Lukas: >>>>>>> >>>>>>> Thanks. Please find the sql, sample jdbc and expected result. >>>>>>> >>>>>>> Regards, >>>>>>> Venkat >>>>>>> >>>>>>> >>>>>>> On Thursday, 6 February 2014 02:47:49 UTC-5, Lukas Eder wrote: >>>>>>> >>>>>>>> Hi Venkat, >>>>>>>> >>>>>>>> Thanks for pointing out these things. I think that the Query >>>>>>>> implementations get these things right, but it's quite possible that >>>>>>>> there >>>>>>>> is some issue with the Routine implementations. Just to be sure, are >>>>>>>> you >>>>>>>> using SQL Server's own sqljdbc_4.0 JDBC driver, or the Open Source >>>>>>>> jTDS? >>>>>>>> >>>>>>>> Could you provide me with a minimal T-SQL example procedure to be >>>>>>>> sure we're going to be fixing things as expected? >>>>>>>> >>>>>>>> In the mean time, I have created an issue for this: >>>>>>>> https://github.com/jOOQ/jOOQ/issues/3011 >>>>>>>> >>>>>>>> This has a high chance of still making it into jOOQ 3.3.0 and 3.2.4 >>>>>>>> >>>>>>>> Thanks >>>>>>>> Lukas >>>>>>>> >>>>>>>> >>>>>>>> 2014-02-05 Venkat Sadasivam <[email protected]>: >>>>>>>> >>>>>>>>> When executing stored procedure against SQL Server 2012 we get >>>>>>>>> different behavior between execute and executeUpdate methods. >>>>>>>>> >>>>>>>>> When raising error from stored procedure execute method doesn't >>>>>>>>> through SQLException whereas executeUpdate method throws as >>>>>>>>> SQLException. >>>>>>>>> >>>>>>>>> As per the Microsoft guidelines when using execute Method is >>>>>>>>> recommended with getMoreResults method invocation to capture complete >>>>>>>>> result. >>>>>>>>> http://blogs.msdn.com/b/jdbcteam/archive/2008/08/01/use- >>>>>>>>> execute-and-getmoreresults-methods-for-those-pesky-complex-sql- >>>>>>>>> queries.aspx >>>>>>>>> >>>>>>>>> Can you provide following option with jOOQ API? >>>>>>>>> 1) Ability to configure jOOQ to either use execute or >>>>>>>>> executeUpdate for stored procedure execution >>>>>>>>> 2) For all the execute method calls getMoreResults method to >>>>>>>>> capture complete data in Java end. >>>>>>>>> >>>>>>>>> Thanks. >>>>>>>>> Venkat >>>>>>>>> >>>>>>>>> -- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "jOOQ User Group" group. >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>> send an email to [email protected]. >>>>>>>>> >>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "jOOQ User Group" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> For more options, visit https://groups.google.com/groups/opt_out. >>>>>>> >>>>>> >>>>>> >>>>> >>>> >>> -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
