You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andreas Pardeike <ap...@fsys.se> on 2009/05/14 14:09:13 UTC

Raw SQL on error/exception i v3.0

Hi,

our backend database sometimes has strange hickups and the admin
kills some of my sql jobs there because they take too much cpu
cycles.

They now ask me what the raw sql statement was (together with which
values were submitted to each '?' in the query) and I cannot easily
answer the question.

So my question: I have a mix of SQLQuery and SQLTemplate. If I get
an exception on a query (in my case a CayenneRuntimeException:
Query exception of type "SQLException: The connection does not exist),
how do I get the latest sql statement?

I found http://www.nabble.com/Auditing-SQL-queries-td21944833.html
but am having a hard time to implement the suggestion.

Any help appreciated,
Andreas Pardeike

Re: Raw SQL on error/exception i v3.0

Posted by Mike Kienenberger <mk...@gmail.com>.
There's lots of ways to get the raw sql.   One way is to turn on
cayenne logging in your application log.   That's normally what I do.

You can also use the p6spy proxy database driver to log all sql.
That works in any environment, and you can control where the logged
sql ends up.

On Thu, May 14, 2009 at 8:09 AM, Andreas Pardeike <ap...@fsys.se> wrote:
> Hi,
>
> our backend database sometimes has strange hickups and the admin
> kills some of my sql jobs there because they take too much cpu
> cycles.
>
> They now ask me what the raw sql statement was (together with which
> values were submitted to each '?' in the query) and I cannot easily
> answer the question.
>
> So my question: I have a mix of SQLQuery and SQLTemplate. If I get
> an exception on a query (in my case a CayenneRuntimeException:
> Query exception of type "SQLException: The connection does not exist),
> how do I get the latest sql statement?
>
> I found http://www.nabble.com/Auditing-SQL-queries-td21944833.html
> but am having a hard time to implement the suggestion.
>
> Any help appreciated,
> Andreas Pardeike
>