Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Logging each actual *real* SQL query

But it's much more convenient to log in the same log as the rest of
your application.

Oftentimes the database isn't even on the same machine.


On Fri, Sep 10, 2010 at 2:07 PM, Derek Knapp <derek@xxxxxxxxxxxxxx> wrote:
> What database are you using? I know with mySQL can log all queries.. and I
> assume others have the same ability.
>
> http://dev.mysql.com/doc/refman/5.1/en/query-log.html
>
>
> Derek
>
> On 10-09-10 02:02 PM, Mike Kienenberger wrote:
>>
>> One solution is to use p6spy.
>>
>> http://www.p6spy.com/
>>
>> P6Spy is an open source framework for applications that intercept and
>> optionally modify database statements.
>>
>> The software isn't well maintained anymore, so some environments make
>> take a bit more work to set up.
>>
>> On Thu, Sep 9, 2010 at 6:54 PM, Torbjorn Kristoffersen
>> <torbjoern@xxxxxxxxx>  wrote:
>>
>>>
>>> How would one go about retrieving each SQL query that the JPA (in this
>>> case, EclipseLink 2) layer performs on the database?
>>> I am interested in absolutely all the SQL queries.  I tried intercepting
>>> them using postUpdate, postInsert and so on, but seeing I use parameter
>>> binding I can't get the actual native SQL query, illustrated by the the FINE
>>> logging as seen in my Glassfish log:
>>> SELECT x,y,z FROM footable WHERE My_ID = ? LIMIT ? OFFSET ?
>>>         bind =>  [274087, 15, 0]|#]
>>> I need to find out the exact query that is run on the actual SQL server.
>>>  In the case above, I can't be certain whether 274087 is an int, or a
>>> string.  If it is a string, then I it would have to be enclosed in quotes.
>>> So what I'm looking for is the following result:
>>> SELECT x,y,z FROM footable WHERE My_ID = '274087' LIMIT 15 OFFSET 0
>>> Hope someone can help... Thanks!
>>> _______________________________________________
>>> eclipselink-users mailing list
>>> eclipselink-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>>
>>>
>>
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>
>
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>


Back to the top