473,804 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2548
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:1155024677 451][Thread:main][Connection@c9d9 2c]
prepareStatemen t (select productimp_.id, productimp_.act ive as
active6_, productimp_.cod e as code6_, productimp_.des cription as
descript4_6_, productimp_.sto ck as stock6_, productimp_.adH ocPrice as
adHocPrice6_, productimp_.cos tPrice as costPrice6_,
productimp_.cat egory as category6_, productimp_.sup plier as supplier6_,
productimp_.typ e as type6_ from Product productimp_ where
productimp_.id= ?) called
[ibm][db2][jcc][Time:1155024677 451][Thread:main][Connection@c9d9 2c]
prepareStatemen t () returned PreparedStateme nt@106dc2d
[ibm][db2][jcc][Time:1155024677 451][Thread:main][PreparedStateme nt@106dc2d]
setLong (1, 522) called
[ibm][db2][jcc][Time:1155024677 451][Thread:main][PreparedStateme nt@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_.act ive as active6_,
productimp_.cod e as code6_, productimp_.des cription as descript4_6_,
productimp_.sto ck as stock6_, productimp_.adH ocPrice as adHocPrice6_,
productimp_.cos tPrice as costPrice6_, productimp_.cat egory as
category6_, productimp_.sup plier as supplier6_, productimp_.typ e 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
2914
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 users). If user is from intranet, web server should recognize it and application should create additional options in controls regarding groups the user belongs to. If user is from extranet it should be logged in as anonymous and a link to login page...
15
9623
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# method to make the parameter optional, or have a default value at the client consumer? --
0
1106
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 this. CREATE OR REPLACE FUNCTION get_table(text) RETURNS SETOF table AS '
1
5833
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, Contacts.Misc2, Contacts.Address1, Contacts.City, Contacts.State, Contacts.Zip1, Contacts.top_50, Contacts.B_ID as BID,'BCM' as thesource FROM Contacts
0
1369
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). Normally, my web methods would look something like this: public ReturnType GetSomeData(SomeType param1) {
11
1472
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 because it would mean one fewer place to have things. But, before we go that route we wanted to ask the question: Is there any compelling reason why we shouldn't abandon all of our stored procs and just write the SQL inside inside our functions in...
3
1458
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 = VM::Generic->new(); my $input = $session->parse_input; my $templateprefix = $input->{'area'} || 'reporting'; $session->validate_session($input);
7
6588
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 WEAQScore0, WEAQScore1,WEAQScore5, MissingWEAQ0, MissingWEAQ1, MissingWEAQ5 The 0, 1, 5 are the @Interval. I am using a cursor to loop through the table. Each row in the table is the data for one person at a given timepoint (0,1,5).
11
3562
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 IQueryable<TLessThan<T>(this IQueryable<Tsource, string property, object value); For example var q = db.Customers.LessThanOrEqual( "City", "London" );
0
9576
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10074
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9138
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5516
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4292
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.