<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Joachim Selke’s Blog</title>
	<atom:link href="http://blog.joachim-selke.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.joachim-selke.de</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 11 Mar 2012 21:38:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>How to Convert ISO Weeks to Dates in Oracle</title>
		<link>http://blog.joachim-selke.de/2012/03/how-to-convert-iso-weeks-to-dates-in-oracle/</link>
		<comments>http://blog.joachim-selke.de/2012/03/how-to-convert-iso-weeks-to-dates-in-oracle/#comments</comments>
		<pubDate>Sun, 11 Mar 2012 21:32:36 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=130</guid>
		<description><![CDATA[Converting a date to an ISO year-week string is easy in Oracle: &#62;SELECT TO_CHAR(DATE &#039;2012-03-11&#039;, &#039;IYYY-IW&#039;) FROM dual; 2012-10 One should think that converting an ISO year-week string back to a date (denoting the first day in this week) should &#8230; <a href="http://blog.joachim-selke.de/2012/03/how-to-convert-iso-weeks-to-dates-in-oracle/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Converting a date to an ISO year-week string is easy in Oracle:<br />
<pre><code>&gt;SELECT TO_CHAR(DATE &#039;2012-03-11&#039;, &#039;IYYY-IW&#039;) FROM dual;

2012-10
</code></pre></p>
<p>One should think that converting an ISO year-week string back to a date (denoting the first day in this week) should also be easy:<br />
<pre><code>&gt;SELECT TO_DATE(&#039;2012-10&#039;, &#039;IYYY-IW&#039;) FROM dual;

ORA-01820: format code cannot appear in date input format
01820. 00000 -&nbsp;&nbsp;&quot;format code cannot appear in date input format&quot;
*Cause:&nbsp;&nbsp;&nbsp;&nbsp;
*Action:
</code></pre></p>
<p>So, obviously this is not supported yet (speaking of version 11g R2).</p>
<p>Therefore, I decided to write a conversion function myself. Here it is:<br />
<pre><code>CREATE OR REPLACE FUNCTION iso_week_to_date
&nbsp;&nbsp;(iso_year IN INTEGER, -- full ISO year, e.g., 2012
&nbsp;&nbsp; iso_week IN INTEGER) -- ISO week
&nbsp;&nbsp;RETURN DATE
IS
&nbsp;&nbsp;jan4_of_iso_year DATE;
&nbsp;&nbsp;first_day_of_iso_year DATE;
&nbsp;&nbsp;iso_date DATE;
&nbsp;&nbsp;iso_date_iso_year INTEGER;
BEGIN
&nbsp;&nbsp;-- Find the first day of iso_year
&nbsp;&nbsp;-- (= the Monday of the week containing January 4th)
&nbsp;&nbsp;jan4_of_iso_year := TO_DATE(iso_year || &#039;-01-04&#039;, &#039;YYYY-MM-DD&#039;);
&nbsp;&nbsp;first_day_of_iso_year := TRUNC(jan4_of_iso_year, &#039;D&#039;);
&nbsp;&nbsp;
&nbsp;&nbsp;-- Add the ISO week (in days)
&nbsp;&nbsp;iso_date := first_day_of_iso_year + 7 * (iso_week - 1);
&nbsp;&nbsp;
&nbsp;&nbsp;-- Check whether iso_week is a valid ISO week
&nbsp;&nbsp;-- (= whether the Thursday of the week containing iso_date is contained in the year iso_year)
&nbsp;&nbsp;iso_date_iso_year := TO_CHAR(iso_date, &#039;IYYY&#039;);
&nbsp;&nbsp;IF iso_date_iso_year &lt;&gt; iso_year THEN
&nbsp;&nbsp;&nbsp;&nbsp;RAISE VALUE_ERROR;
&nbsp;&nbsp;END IF;
&nbsp;&nbsp;
&nbsp;&nbsp;RETURN iso_date;
END;
</code></pre></p>
<p>A quick test:<br />
<pre><code>SELECT iso_week_to_date(2012, 10) FROM dual;

2012-03-05 00.00.00
</code></pre></p>
<p>Another one:<br />
<pre><code>SELECT iso_week_to_date(2012, 1234) FROM dual;

ORA-06502: PL/SQL: numeric or value error
ORA-06512: at &quot;JSELKE.ISO_WEEK_TO_DATE&quot;, line 23
06502. 00000 -&nbsp;&nbsp;&quot;PL/SQL: numeric or value error%s&quot;
*Cause:&nbsp;&nbsp;&nbsp;&nbsp;
*Action:
</code></pre></p>
<p>Perfect. <img src='http://blog.joachim-selke.de/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Have fun!</p>
<p>Edit: For those prefering plain SQL:<br />
<pre><code>SELECT TRUNC(TO_DATE(2012 || &#039;-01-04&#039;, &#039;YYYY-MM-DD&#039;), &#039;D&#039;) + 7 * (10 - 1) FROM dual;

2012-03-05 00.00.00
</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2012/03/how-to-convert-iso-weeks-to-dates-in-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stripping (HTML) tags in XSLT</title>
		<link>http://blog.joachim-selke.de/2011/01/stripping-html-tags-in-xslt/</link>
		<comments>http://blog.joachim-selke.de/2011/01/stripping-html-tags-in-xslt/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 09:27:23 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=120</guid>
		<description><![CDATA[As there doesn&#8217;t seem to be any built-in function in XLST for stripping tags from strings (e.g., to remove all markup from a piece of HTML-formatted text), people came up with a recursive template-based solution, which has been posted several &#8230; <a href="http://blog.joachim-selke.de/2011/01/stripping-html-tags-in-xslt/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As there doesn&#8217;t seem to be any built-in function in XLST for stripping tags from strings (e.g., to remove all markup from a piece of HTML-formatted text), people came up with a recursive template-based solution, which has been posted several times on the web (e.g., <a href="http://blog.thekid.me.uk/archive/2007/05/17/stripping-html-tags-when-using-xslt.aspx">here</a>). However, I found this approach hard to use when the string to be cleaned from all tags already is stored in a variable or is created by using a xsl:value-of statement. Therefore, I transformed the existing template-based solution into a function-based one, which is a bit shorter and easier to use. Here it is:</p>
<p><pre><code>&lt;xsl:function name=&quot;util:strip-tags&quot;&gt;
&nbsp;&nbsp;&lt;xsl:param name=&quot;text&quot;/&gt;
&nbsp;&nbsp;&lt;xsl:choose&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:when test=&quot;contains($text, &#039;&amp;lt;&#039;)&quot;&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:value-of select=&quot;concat(substring-before($text, &#039;&amp;lt;&#039;),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;util:strip-tags(substring-after($text, &#039;&amp;gt;&#039;)))&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsl:when&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:otherwise&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;xsl:value-of select=&quot;$text&quot;/&gt;
&nbsp;&nbsp;&nbsp;&nbsp;&lt;/xsl:otherwise&gt;
&nbsp;&nbsp;&lt;/xsl:choose&gt;
&lt;/xsl:function&gt;</code></pre></p>
<p><strong>Note:</strong> Don&#8217;t forget to declare a namespace for this function (called <code>util</code> in the above code).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2011/01/stripping-html-tags-in-xslt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where to Download the DB2 JDBC driver</title>
		<link>http://blog.joachim-selke.de/2010/12/where-to-download-the-db2-jdbc-driver/</link>
		<comments>http://blog.joachim-selke.de/2010/12/where-to-download-the-db2-jdbc-driver/#comments</comments>
		<pubDate>Tue, 21 Dec 2010 13:48:25 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[DB2]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=113</guid>
		<description><![CDATA[When you want to access a DB2 database from Java, you usually need IBM&#8217;s JDBC driver for DB2. In the past, I (and some other people I know) always had trouble in finding out where to download the recent version &#8230; <a href="http://blog.joachim-selke.de/2010/12/where-to-download-the-db2-jdbc-driver/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>When you want to access a DB2 database from Java, you usually need IBM&#8217;s JDBC driver for DB2. In the past, I (and some other people I know) always had trouble in finding out where to download the recent version of the driver. To solve this issue once and for all, I just took a deep dive into IBM&#8217;s website. There I found the following page, which seems to be ultimate resource to downloading DB2&#8242;s JDBC driver: <a href="https://www-304.ibm.com/support/docview.wss?uid=swg21363866">https://www-304.ibm.com/support/docview.wss?uid=swg21363866</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/12/where-to-download-the-db2-jdbc-driver/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Steve Jobs&#8217; Macworld 2007 Keynote (iPhone Introduction) in High Quality</title>
		<link>http://blog.joachim-selke.de/2010/11/steve-jobs-macworld-2007-keynote-in-high-quality/</link>
		<comments>http://blog.joachim-selke.de/2010/11/steve-jobs-macworld-2007-keynote-in-high-quality/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 08:53:38 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=108</guid>
		<description><![CDATA[For a course about giving good presentations we are currently offering at work, I was looking for a high-quality version of Steve Jobs&#8217; famous iPhone introduction at Macworld 2007. When searching on YouTube, I only got videos in awful resolutions. &#8230; <a href="http://blog.joachim-selke.de/2010/11/steve-jobs-macworld-2007-keynote-in-high-quality/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For a <a href="http://www.ifis.cs.tu-bs.de/teaching/ws-1011/seminar">course about giving good presentations</a> we are currently offering at work, I was looking for a high-quality version of Steve Jobs&#8217; famous iPhone introduction at Macworld 2007. When searching on YouTube, I only got videos in awful resolutions. Even the <a href="http://www.apple.com/quicktime/qtv/mwsf07/">“official” video stream</a> offered by Apple isn&#8217;t too impressive (<a href="rtsp://a2047.v1409b.c1409.g.vq.akamaistream.net/5/2047/1409/1_pt2_350/1a1a1ae252c22e93fe63dc4ab92d92c024930a78e453b41846a71273e041aad83baa174677abdb14/sub8848125_2_350.mov">direct link to the stream</a>). I spent some time on searching for a better version and finally came up with the following (if you want to download these files, you can use tools such as <a href="http://freshmeat.net/projects/youtube-dl">youtube-dl</a>):</p>
<p><a href="http://www.youtube.com/watch?v=-QZKy9FzR6k">Part 1</a><br />
<a href="http://www.youtube.com/watch?v=4AV3YMu2LtU">Part 2</a><br />
<a href="http://www.youtube.com/watch?v=YPGbaJCM2JQ">Part 3</a><br />
<a href="http://www.youtube.com/watch?v=9FsuOIH14Qs">Part 4</a><br />
<a href="http://www.youtube.com/watch?v=9P52CuCuT4A">Part 5</a><br />
<a href="http://www.youtube.com/watch?v=9n_P9pOENl0">Part 6</a><br />
<a href="http://www.youtube.com/watch?v=8fOewuVG9nM">Part 7</a><br />
<a href="http://www.youtube.com/watch?v=4OssbAnmKTI">Part 8</a><br />
<a href="http://www.youtube.com/watch?v=Wq78jl4CATU">Part 9</a><br />
<a href="http://www.youtube.com/watch?v=mBSq52i_bI0">Part 10</a><br />
<a href="http://www.youtube.com/watch?v=w3jFf448qrs">Part 11</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/11/steve-jobs-macworld-2007-keynote-in-high-quality/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>VMware Workstation 7.1.2 and Fedora 14</title>
		<link>http://blog.joachim-selke.de/2010/11/vmware-workstation-7-1-2-and-fedora-14/</link>
		<comments>http://blog.joachim-selke.de/2010/11/vmware-workstation-7-1-2-and-fedora-14/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 10:05:19 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[VMware]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=105</guid>
		<description><![CDATA[UPDATE: VMware Workstation 7.1.3 works out of the box with Fedora 14. As always, VMware has not been able to keep up with recent changes in Linux (kernel 2.6.35 and up). This becomes apparent, when trying to run VMware Workstation &#8230; <a href="http://blog.joachim-selke.de/2010/11/vmware-workstation-7-1-2-and-fedora-14/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><strong>UPDATE: VMware Workstation 7.1.3 works out of the box with Fedora 14.</strong></p>
<p>As always, VMware has not been able to keep up with recent changes in Linux (kernel 2.6.35 and up). This becomes apparent, when trying to run VMware Workstation in the new Fedora 14. Compiling the VMware kernel module fails with errors like the following:</p>
<p><pre><code>error: implicit declaration of function ‘iommu_unmap_range’
error: ‘struct sock’ has no member named ‘sk_sleep’</code></pre></p>
<p>Combining the hints from <a href="http://www.rrfx.net/2010/06/vmware-vmmon-module-compilation-issues.html">here</a> and <a href="http://www.linuxinsight.com/persuading-vmware-workstation-7.1-to-cooperate-with-linux-kernel-2.6.35.html">here</a>, I arrived at the following solution, which patches VMware&#8217;s kernel module:</p>
<p><pre><code>cd /tmp
tar xvf /usr/lib/vmware/modules/source/vmmon.tar -C /tmp
perl -pi -e &#039;s,_range,,&#039; vmmon-only/linux/iommu.c
sudo tar cvf /usr/lib/vmware/modules/source/vmmon.tar vmmon-only

cd /tmp
tar xvf /usr/lib/vmware/modules/source/vsock.tar -C /tmp
perl -pi -e &#039;s,sk-&gt;compat_sk_sleep,compat_sk_sleep(sk),&#039; vsock-only/linux/af_vsock.c
perl -pi -e &#039;s,listener-&gt;compat_sk_sleep,compat_sk_sleep(listener),&#039; vsock-only/linux/af_vsock.c
sudo tar cvf /usr/lib/vmware/modules/source/vsock.tar vsock-only

sudo vmware-modconfig --console --install-all</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/11/vmware-workstation-7-1-2-and-fedora-14/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Running MATLAB scripts on a remote server</title>
		<link>http://blog.joachim-selke.de/2010/05/running-matlab-scripts-on-a-remote-server/</link>
		<comments>http://blog.joachim-selke.de/2010/05/running-matlab-scripts-on-a-remote-server/#comments</comments>
		<pubDate>Mon, 03 May 2010 16:16:10 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[MATLAB]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=95</guid>
		<description><![CDATA[I often have to run some experiments with large data sets in MATLAB. Therefore, it comes handy to do this on a machine that is different from my notebook. The following bash script remotely runs a given MATLAB script called &#8230; <a href="http://blog.joachim-selke.de/2010/05/running-matlab-scripts-on-a-remote-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I often have to run some experiments with large data sets in MATLAB. Therefore, it comes handy to do this on a machine that is different from my notebook. The following bash script remotely runs a given MATLAB script called <code>matlabbg</code> and writes all console output to some logfile:</p>
<p><pre><code>#!/bin/bash
nohup matlab -nodisplay -r &quot;run $1&quot; &gt;$2 2&gt;&amp;1 &amp;</code></pre></p>
<p>To run the MATLAB script <code>myscript.m</code> in the background and write the output to <code>myscript.log</code>, simply do the following:</p>
<p><code>matlabbg myscript.m myscript.log</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/05/running-matlab-scripts-on-a-remote-server/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DB2: How to Add an Identity Column to an Existing Table</title>
		<link>http://blog.joachim-selke.de/2010/04/add-identity-column-db2/</link>
		<comments>http://blog.joachim-selke.de/2010/04/add-identity-column-db2/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 14:20:25 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[DB2]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=93</guid>
		<description><![CDATA[Adding generated key columns to existing tables seems to be complicated in DB2. The following code adds a new generated primary key id to the table tablename. Granted, the code is ugly, but it works. I was not able to &#8230; <a href="http://blog.joachim-selke.de/2010/04/add-identity-column-db2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Adding generated key columns to existing tables seems to be complicated in DB2. The following code adds a new generated primary key <code>id</code> to the table <code>tablename</code>. Granted, the code is ugly, but it works. I was not able to come up with a better solution in time.</p>
<p><pre><code>
ALTER TABLE tablename ADD COLUMN id INTEGER NOT NULL WITH DEFAULT 0
ALTER TABLE tablename ALTER COLUMN id GENERATED BY DEFAULT AS IDENTITY
REORG TABLE tablename
UPDATE tablename SET id = DEFAULT
ALTER TABLE tablename ALTER COLUMN id SET PRIMARY KEY
</code></pre></p>
<p>EDIT: I tested this code with DB2 9.7, but it should work on earlier versions of DB2.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/04/add-identity-column-db2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Windows 7: Persistent Storage of Login Credentials for Samba Shares</title>
		<link>http://blog.joachim-selke.de/2010/02/windows-7-persistent-storage-of-login-credentials-for-samba-shares/</link>
		<comments>http://blog.joachim-selke.de/2010/02/windows-7-persistent-storage-of-login-credentials-for-samba-shares/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 10:51:07 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=86</guid>
		<description><![CDATA[I have a Windows 7 installation running in a VMware virtual machine. Within Windows, I mounted a network drive pointing to a Samba share within our local network, which is secured by username/password. However, although I told Windows several times &#8230; <a href="http://blog.joachim-selke.de/2010/02/windows-7-persistent-storage-of-login-credentials-for-samba-shares/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I have a Windows 7 installation running in a VMware virtual machine. Within Windows, I mounted a network drive pointing to a Samba share within our local network, which is secured by username/password. However, although I told Windows several times to remember my login credentials (username/password) when it asked for them, Windows stored them only for the current session. This can be seen using Windows&#8217; credential manager (Control Panel\User Accounts and Family Safety\Credential Manager). Therefore, the data was lost after each reboot and I had to enter them again.</p>
<p>There is a simple (but strange) solution to this problem: Instead of entering just your username when asked for, enter SERVERNAME\USERNAME. Adding the server name as &#8220;remote domain&#8221; makes Windows think that you are located within a &#8220;trustworthy&#8221; enterprise environment. Then, your login credentials are stored persistently, thus surviving reboots. Thanks to Microsoft for this intuitive mechanism.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/02/windows-7-persistent-storage-of-login-credentials-for-samba-shares/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to look up SQL error codes quickly in DB2</title>
		<link>http://blog.joachim-selke.de/2010/01/how-to-look-up-sql-error-codes-quickly-in-db2/</link>
		<comments>http://blog.joachim-selke.de/2010/01/how-to-look-up-sql-error-codes-quickly-in-db2/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 15:50:55 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[DB2]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=82</guid>
		<description><![CDATA[Quite regularly DB2 complains about my SQL statements and usually returns a cryptic error message including an even more cryptic SQL error code. What I normally do in those situations is looking up the error code in the DB2 Information &#8230; <a href="http://blog.joachim-selke.de/2010/01/how-to-look-up-sql-error-codes-quickly-in-db2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Quite regularly DB2 complains about my SQL statements and usually returns a cryptic error message including an even more cryptic SQL error code. What I normally do in those situations is looking up the error code in the <a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r7">DB2 Information Center</a>, which takes some time. I just found out that there is an easier way to get at least a short explanation of what an error code means. For example, to look up the error code -161, you can use the following SQL query:</p>
<p><code>VALUES SQLERRM(-161)</code></p>
<p>Result:</p>
<p><pre><code>1
------------------------------------------------------------------------------------------------------
SQL0161N&nbsp;&nbsp;The resulting row of the insert or update operation does not conform to the view definition.</code></pre></p>
<p>Nice.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/01/how-to-look-up-sql-error-codes-quickly-in-db2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>What SQL statements are currently running on my DB2 database server?</title>
		<link>http://blog.joachim-selke.de/2010/01/what-sql-statements-are-currently-running-on-my-db2-database-server/</link>
		<comments>http://blog.joachim-selke.de/2010/01/what-sql-statements-are-currently-running-on-my-db2-database-server/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 12:58:25 +0000</pubDate>
		<dc:creator>Joachim Selke</dc:creator>
				<category><![CDATA[DB2]]></category>

		<guid isPermaLink="false">http://blog.joachim-selke.de/?p=78</guid>
		<description><![CDATA[To see some detailed info about which users are currently connected to your DB2 database server (including the SQL statements they are running), you can use the following query (tested with DB2 9.7, fixpack 3a): &#160;&#160;&#160;&#160;WITH a AS (SELECT a.application_handle, &#8230; <a href="http://blog.joachim-selke.de/2010/01/what-sql-statements-are-currently-running-on-my-db2-database-server/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To see some detailed info about which users are currently connected to your DB2 database server (including the SQL statements they are running), you can use the following query (tested with DB2 9.7, fixpack 3a):</p>
<p><pre><code>&nbsp;&nbsp;&nbsp;&nbsp;WITH a AS (SELECT a.application_handle, a.system_auth_id, a.application_name, a.client_wrkstnname, a.workload_name, a.workload_occurrence_state, b.activity_id, b.uow_id, b.local_start_time, b.activity_state, b.activity_type, b.total_cpu_time, b.rows_read, b.rows_returned, b.query_cost_estimate, b.direct_reads, b.direct_writes
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM TABLE(wlm_get_service_class_workload_occurrences_v97(NULL, NULL, NULL)) a
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LEFT JOIN TABLE(wlm_get_workload_occurrence_activities_v97(NULL, NULL)) b ON a.application_handle = b.application_handle),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; b AS (SELECT t.*
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM TABLE(mon_get_activity_details(FOR EACH ROW OF (SELECT application_handle, uow_id, activity_id, NULL FROM a WHERE activity_id &gt; 0))) t),
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; c AS (SELECT x.&quot;activity_id&quot; activity_id, x.&quot;uow_id&quot; uow_id, x.&quot;stmt_text&quot; stmt_text
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FROM b,
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;XMLTABLE(XMLNAMESP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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;stmt_text&quot; VARCHAR(1024) PATH &#039;stmt_text&#039;) x)
&nbsp;&nbsp;SELECT a.*, TRANSLATE(c.stmt_text, &#039; &#039;, CHR(10)) stmt_text
&nbsp;&nbsp;&nbsp;&nbsp;FROM a
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LEFT JOIN c ON a.activity_id = c.activity_id AND a.uow_id = c.uow_id
&nbsp;&nbsp; WHERE stmt_text IS NULL OR SUBSTR(stmt_text, 1, 40) &lt;&gt; &#039;WITH a AS (SELECT a.application_handle, &#039;
ORDER BY application_handle, a.activity_id</code></pre></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.joachim-selke.de/2010/01/what-sql-statements-are-currently-running-on-my-db2-database-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

