DataBase - Simple debugging of procedures?

Asked By Troels Arvin
05-Sep-10 05:17 PM
Hello,

Is there a simple way to debug DB2 SQL procedures, such as: which branch
of a conditional construct was chosen, what value did a counter reach,
etc, _without_ installing some big, complicated IDE?

My question could maybe be rephrased as "is there a way to perform printf-
style debugging in DB2 SQL procedures?"

If not: I am considering creating a C-based UDF which logs arbitrary
strings to syslog, so that a SQL procedure can inform the surroundings of
its state during development.

--
Troels
Oracle
(1)
Willem Fischer
(1)
Troels Hello
(1)
Otherwise
(1)
Compatibility feature
(1)
Developerworks
(1)
DBMS OUTPUT
(1)
  Willem Fischer replied to Troels Arvin
05-Sep-10 07:05 PM
-

I do not know if Serge's SQL PL/PL/SQL profiler would be of use:
http://www.google.com/url?sa=3DD&q=3Dhttps://www.ibm.com/developerworks/myd=
eveloperworks/wikis/home%3Flang%3Den_US%23/wiki/DB2%2520for%2520LUW%2520App=
lication%2520Enablement/page/PLSQL%2520Profiler&usg=3DAFQjCNEOV8T4GT-te1x6w=
EjqjrdlB7VRmg

(I hope this link works, otherwise he had posted it a short while
ago.)

What else comes to my mind is a debug table and a debug function,
something like insert into dbg values (current timestamp, message).

PL/SQL should have a debug function built in if you are on V9.7.

Sorry, mainly guesses here.
  Troels Arvin replied to Willem Fischer
06-Sep-10 03:33 AM
Hello,

[...]

I am not thinking about performance at this point, but may come in handy
later on.



Yes, but can such inserts be done outside of the currently running
transaction? - Otherwise I suppose that no messages will end up in the
message-table?



That's interesting. I suppose this relates to DBMS_OUTPUT which seems to
be exactly what I was looking for. Thanks.

--
Troels
  Troels Arvin replied to Troels Arvin
06-Sep-10 06:42 AM
Hello,


Hmm. DBMS_OUTPUT requires that Oracle compatibility be enabled :-(

Is Oracle compatibility enabled in all DB2 LUW 9.7 editions, or does it
require a special licence?

--
Troels
  The Boss replied to Troels Arvin
06-Sep-10 10:28 AM
o

It depends on which specific compatibility feature you want to use.
DB2 Enterprise Edition is the only version that supports the full
spectrum.
Regarding DBMS_OUTPUT (and other system-defined modules), this is
supported in Workgroup Edition but not in Personal Edition or Express(-
C) Edition, see:
http://publib.boulder.ibm.com/infocenter/db2luw/v9r7/index.jsp?topic=3D/com=
.ibm.db2.luw.sql.rtn.doc/doc/c0053670.html

You may also want to checkout this forum-post on DeveloperWorks:
http://www.ibm.com/developerworks/forums/thread.jspa?messageID=3D14485419&t=
start=3D0

HTH

--
Jeroen
  Ian replied to Troels Arvin
07-Sep-10 03:17 AM
One thing you can do is create a global temporary table, and have
your
procedure insert records into the GTT.  Then, simply query your GTT
to
see your output...
  Serge Rielau replied to The Boss
07-Sep-10 08:24 AM
Troels,

DBMS_OUTPUT is supported without compatibility vector.
Also if you search for my name on developerworks you will find an
article on SQL PL "tracing".
Out of the box it only logs entry/exit/error, but I also provided a DATA
function which you can embed as printf.

There was some snafu in DB2 9.7.0 for Windows with the library used
which was rectified no later than FP2. So if you want to go that route
ensure you are on the latest and greatest on Windows.

Also if you use the SQL PL / PL/SQL profiler you can execute it after
flushing the package cache to get an individual run.
(Probably not something to do on a production machine...)

Send me a note and I send you a more streamlined version of the profiler...

Cheers
Serge
--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab
help
5800 for Oracle on a dual quad core xeon? DataBase Ok, riddle me this. . . According to the article. . users driving the system, and the box, which ran Oracle Enterprise Linux (Oracle's clone of Red Hat's Enterprise Linux 5) to cut costs as well as Oracle's 11g Standard Edition One database, was able to process 631, 766 TPC-C transactions run for their money." That is, an 8 core (2 quad core xenons) cost of Oracle is $5, 800.00? C'mon. Looks like Oracle is playing fun and games with their pricing. How much would IDS cost for such And then add in the 3 years of maintenance. Very interesting. Informix Discussions Informix (1) Oracle (1) Linux (1) OpenSuSE (1) Database (1) IBMers (1) Report (1) MySQL (1) How do can see the numbers yourself on page 8 of the full disclosure document. Server Software: Oracle Database 11g Standard Edition One, Unlimited Users , 3 years Price per socket: 2, 900 Total
Insert Record into Oracle Table DataBase In Access 2003 running under XP Pro I would like to update an Oracle table within my Access application, but I am always prompted for the password. Within Oracle I used local naming (using the Oracle Net Manager) to create a connection to the Oracle database. I then created a system DSN for the Oracle database using the Oracle driver in Access. The driver does not ask for a password unlike the driver for statement to insert a record, but everytime the SQL runs I get prompted for the Oracle database password. Can the password be set in the SQL string so that I will
ODBC - Connecting MS Access to Oracle 10g DataBase All workstations have the exact ODBC connections to the 3 Oracle databases (Prod, Test, Dev) using the Oracle in OraClient 10g_home1 driver. Using my workstation, I can view / execute tables and stored procs in all 3 Oracle databases in MS Access. For the other users, they can only view / execute Oracle tables and stored procs in Prod. They get an error message trying to view / execute objects in the other Oracle databases: ODBC - connection to <database> failed. [Oracle][ODBC][Ora]ORA-12154: TNS:could not resolve the connect identified specified (#12154)[Microsoft][ODBC failed (#0) On our laptop, it cannot view / execute objects in any of the 3 Oracle databases. HOWEVER, when I test the connections to the 3 databases in ODBC from any
MSSQL2005 -> Oracle: Fehler 7356 DataBase , Oracle:, Fehler, 7356" / > Hallo, folgende Fehlermeldung erhalte ich, bei einem Zugriff über einen Verbindungsserver zu Oracle: * ** ** Der OLE DB-Anbieter 'MSDAORA' für den Verbindungsserver 'WINCARAT' hat inkonsistente Metadaten für eine Spalte Express versucht, aber auch hier dasselbe. Volker Access Client Server Discussions SQL Server 2008 (1) Oracle (1) DB (1) Lt (1) Fehlermeldung (1) Ordnungszahl (1) Eine Idee (1) Metadaten (1) Sorry falsche Gruppe! description: Hallo, folgende Fehlermeldung erhalte ich, bei einem Zugriff über einen Verbindungsserver zu Oracle: * ** ** Der OLE DB-Anbieter 'MSDAORA' für den Verbindu