473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Logging dynamic SQL with query params

Hi All,

we're new to DB2 (using Express-C on Windows). We'd like to monitor the
SQL that Hibernate (a Java ORM) generates, along with query params. It
was quite simple to do so with MySQL, but we haven't found a way to do
that with DB2.
This is how far we got:
create event monitor sqlmonitor for statements write to file
'f:\tmp\db2sql'
set event monitor sqlmonitor state = 1
.... issue some sql ...
db2evmon -db minibar -evm sqlmonitor >sql.txt
grep "Text" sql.txt

This is quite inconvenient, and does not give us query params (we could
get the parameterless statements from Hibernate's own log in a much
simpler way).
It seems we're using the wrong tool - but which one is the right one?

TIA,
Kofa

Aug 7 '06 #1
2 2517
we're new to DB2 (using Express-C on Windows). We'd like to monitor the
SQL that Hibernate (a Java ORM) generates, along with query params.
To answer my own question: the JDBC driver can be set to trace
commands.
http://www-128.ibm.com/developerwork...m-0506fechner/

<blush>Sorry for the noise</blush>

Kofa

Aug 7 '06 #2

kofa wrote:
we're new to DB2 (using Express-C on Windows). We'd like to monitor the
SQL that Hibernate (a Java ORM) generates, along with query params.

To answer my own question: the JDBC driver can be set to trace
commands.
http://www-128.ibm.com/developerwork...m-0506fechner/

<blush>Sorry for the noise</blush>

Kofa
Still not good enough.
Here's an excerpt from the log:
[ibm][db2][jcc][Time:1155024677451][Thread:main][Connection@c9d92c]
prepareStatement (select productimp_.id, productimp_.active as
active6_, productimp_.code as code6_, productimp_.description as
descript4_6_, productimp_.stock as stock6_, productimp_.adHocPrice as
adHocPrice6_, productimp_.costPrice as costPrice6_,
productimp_.category as category6_, productimp_.supplier as supplier6_,
productimp_.type as type6_ from Product productimp_ where
productimp_.id=?) called
[ibm][db2][jcc][Time:1155024677451][Thread:main][Connection@c9d92c]
prepareStatement () returned PreparedStatement@106dc2d
[ibm][db2][jcc][Time:1155024677451][Thread:main][PreparedStatement@106dc2d]
setLong (1, 522) called
[ibm][db2][jcc][Time:1155024677451][Thread:main][PreparedStatement@106dc2d]
executeQuery () called

Not very easy to read (params shown on a separate line, in an even more
verbose fashion than we could get directly from Hibernate). The same
thing with MySQL:
Query select productimp_.id, productimp_.active as active6_,
productimp_.code as code6_, productimp_.description as descript4_6_,
productimp_.stock as stock6_, productimp_.adHocPrice as adHocPrice6_,
productimp_.costPrice as costPrice6_, productimp_.category as
category6_, productimp_.supplier as supplier6_, productimp_.type as
type6_ from Product productimp_ where productimp_.id=522

Any ideas (without costly third-party tools)?

TIA,
Kofa

Aug 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pv | last post by:
Hi everyone, I need help with following scenario, please: Users are accessing same web server from intranet (users previously authenticated in Active Dir) and from extranet (common public...
15
by: WHY | last post by:
Since there's no way to create a c# method with optional, or nullable parameters. And since you can't write an overloaded web method. Is it possible to edit the WSDL in conjunction with a c#...
0
by: Robin Ericsson | last post by:
Hi, I want to create a stored procedure that can take a dynamic number of in-parameters and base an inside-query based on those parameters. My ideas was to use text as input parameters like...
1
by: forey | last post by:
Hi All, I'm trying to find the best way to accomplish the following: I have a union query in an Access XP database (pasted below) SELECT Contacts.Company,Contacts.dba, Contacts.Misc1,...
0
by: rshekhtm | last post by:
Hi everyone, I would like to get your opinion on a technique I came up with when faced with the problem of redundant code in every web method (authentication, logging, exception handling)....
11
by: Ronald S. Cook | last post by:
I've read a few posts on the stored procedure vs dynamic sql debate. I ran a few performance test for myself and it appears to be a wash. Given that, I'm leaning toward dynamic sql mostly...
3
by: patelxxx | last post by:
Guy's, I'm using the following code and before I even enter my username and password I get the following error: 'Username or password did not match', what I'm I doing wrong? my $session =...
7
by: bprocopio | last post by:
Please help. I'm stumped. I need to create a dynamic variable in a procedure that will be used to update a variable of the same name in a table. i.e. the name in tblAnalysisScores are...
11
by: Andrus | last post by:
I created dynamic extension methods for <= and < SQL comparison operators: public static IQueryable<TLessThanOrEqual<T>(this IQueryable<Tsource, string property, object value); public static...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.