<?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>Snowulf &#187; Database</title>
	<atom:link href="http://snowulf.com/category/Database/feed/" rel="self" type="application/rss+xml" />
	<link>http://snowulf.com</link>
	<description>It's okay, we know you read other blogs, we're fine with open relationships.</description>
	<lastBuildDate>Wed, 08 Sep 2010 17:00:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Error: SQL1159  Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.0</title>
		<link>http://snowulf.com/2010/07/20/error-sql1159-initialization-error-with-db2-net-data-provider-reason-code-10-tokens-0-0-0-9-7-0/</link>
		<comments>http://snowulf.com/2010/07/20/error-sql1159-initialization-error-with-db2-net-data-provider-reason-code-10-tokens-0-0-0-9-7-0/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 17:00:22 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[Stupid Companies]]></category>
		<category><![CDATA[.NET Data Provider]]></category>
		<category><![CDATA[db2]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[IBM.DATA.DB2]]></category>
		<category><![CDATA[reason code 10]]></category>
		<category><![CDATA[SQL1159]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Visual Studio 2005]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://snowulf.com/?p=1430</guid>
		<description><![CDATA[This past weekend I spent way too much time with Jon while trying to get our new work machines setup. Normally most of the time is spent waiting for Visual Studio to install (seriously that thing takes forever), but not so this time. DB2 kept refusing to work and play well with others. Specifically the [...]]]></description>
			<content:encoded><![CDATA[<p>This past weekend I spent way too much time with Jon while trying to get our new work machines setup.  Normally most of the time is spent waiting for Visual Studio to install (seriously that thing takes forever), but not so this time.  DB2 kept refusing to work and play well with others.  Specifically the driver that .NET uses to communicate with, and thus began several hours of googling and downloading and installing.  </p>
<p><span id="more-1430"></span>Before installing anything more than just Visual Studio 2005 (and doing a build of course), I tried to login and got:<br />
<code>Could not load file or assembly 'IBM.Data.DB2, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208' or one of its dependencies. The system cannot find the file specified.</code><br />
This wasn&#8217;t surprising as I had not yet installed any DB2 drivers.<br />
So then I went and installed what I thought was the correct bit (ibm_data_server_client_win32_V97.zip) and got:<br />
<code>SQL1159  Initialization error with DB2 .NET Data Provider, reason code 10, tokens 0.0.0, 9.7.0</code><br />
After scouring the internet, I found a post informing me that on 64 bit machines, the install will falsely report it completed successfully and fails to update the machine.config.  To resolve it advised adding the following:</p>
<blockquote><p>&lt;DbProviderFactories><br />
      &lt;add name=&#8221;IBM DB2 .NET Data Provider&#8221; invariant=&#8221;IBM.Data.DB2&#8243; description=&#8221;IBM DB2 Data Provider for .NET Framework 2.0&#8243; type=&#8221;IBM.Data.DB2.DB2Factory, IBM.Data.DB2, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208&#8243; /><br />
      &lt;add name=&#8221;IBM Informix .NET Data Provider&#8221; invariant=&#8221;IBM.Data.Informix&#8221; description=&#8221;IBM Informix Data Provider for .NET Framework 2.0&#8243; type=&#8221;IBM.Data.Informix.IfxFactory, IBM.Data.Informix, Version=9.0.0.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208&#8243; /><br />
      &lt;add name=&#8221;IBM DB2 .NET Data Provider 9.7.2&#8243; invariant=&#8221;IBM.Data.DB2.9.7.2&#8243; description=&#8221;IBM DB2 Data Provider 9.7.2 for .NET Framework 2.0&#8243; type=&#8221;IBM.Data.DB2.DB2Factory, IBM.Data.DB2.9.7.2, Version=9.7.2.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208&#8243; /><br />
      &lt;add name=&#8221;IBM Informix .NET Data Provider 9.7.2&#8243; invariant=&#8221;IBM.Data.Informix.9.7.2&#8243; description=&#8221;IBM Informix Data Provider 9.7.2 for .NET Framework 2.0&#8243; type=&#8221;IBM.Data.Informix.IfxFactory, IBM.Data.Informix.9.7.2, Version=9.7.2.2, Culture=neutral, PublicKeyToken=7c307b91aa13d208&#8243; /><br />
&lt;/DbProviderFactories></p></blockquote>
<p>to my existing file (C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG), since I&#8217;m on a 64 bit box, I also added it to the 64 bit version (C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG).</p>
<p>Did an iisreset, same error, more hair pulling.  I downloaded various other things from IBM&#8217;s website all of which promised to hold the key.  Eventually, I finally find that what I need is DB2 Express-C (db2exc_972_WIN_x86_64.zip).  As soon as that got installed, things worked just peachy, and both machine.configs were properly updated.</p>
<p>Here&#8217;s my big complaint: when I went and looked at an existing working dev environment (my desktop), Add/Remove Programs said only &#8220;IBM Data Server Client &#8211; DB2COPY1&#8243;, which is exactly what the other programs I installed said.  So each time I spent hours looking for some possible setting that was missing, only to find there was no mythical setting, IBM just couldn&#8217;t be bothered to put in different names for their installed products.  If the Add/Remove Programs entry had instead included &#8220;Express-C&#8221;, I could have gotten both machines installed with their dev environments ready to go in under an hour.  Fortunately, on the new installs, it appears that there is now an entry for this item, so if I ever manage to forget all this, I will know what I need.</p>
]]></content:encoded>
			<wfw:commentRss>http://snowulf.com/2010/07/20/error-sql1159-initialization-error-with-db2-net-data-provider-reason-code-10-tokens-0-0-0-9-7-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Serendipity to WordPress – Changing table prefix</title>
		<link>http://snowulf.com/2010/06/17/serendipity-to-wordpress-%e2%80%93-changing-table-prefix/</link>
		<comments>http://snowulf.com/2010/06/17/serendipity-to-wordpress-%e2%80%93-changing-table-prefix/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 17:00:14 +0000</pubDate>
		<dc:creator>Jon</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[access denied]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[s9y]]></category>
		<category><![CDATA[serendipity]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://snowulf.com/?p=938</guid>
		<description><![CDATA[While this isn&#8217;t strictly part of the migration process from S9y to WordPress, I decided to take some advice I read on the net and change the prefix for WordPress tables.  Most use this feature for when they have to share a database, but the suggestions I read said to do it to help prevent [...]]]></description>
			<content:encoded><![CDATA[<p>While this isn&#8217;t strictly part of the migration process from S9y to WordPress, I decided to take some advice I read on the net and change the prefix for WordPress tables.  Most use this feature for when they have to share a database, but the suggestions I read said to do it to help prevent from SQL injection hacks.  Basically the majority of these injections presume a default of &#8216;wp_&#8217; prefix.</p>
<p><span id="more-938"></span>I made this after install very simple by going in MySQL and running <em>RENAME TABLE `wp_posts` TO `prefix_posts`</em> against each table (where &#8220;prefix_&#8221; was the new prefix).  After changing it in MySQL, I changed the wp-config.php line of <em>$table_prefix  = &#8216;wp_&#8217;;</em> to read as my new prefix.  I popped up to the web and the blog worked fine.  Except&#8230; I couldn&#8217;t access the administrative interface.</p>
<blockquote><p><strong>You do not have sufficient permissions to access this page.</strong></p></blockquote>
<p>LIAR!!! What the hell? Yes I do.  I did 10 minutes ago and I should now.  I tried my other (administrative) users, same problem.  This was quite displeasing to me.  After a little googling about, I <a href="http://beconfused.com/2007/08/28/how-to-solve-you-do-not-have-sufficient-permissions-to-access-this-page-in-wordpress/">found out</a> that the answer is that the `meta_key` prefix of &#8216;wp_&#8217; (in `wp_usermeta`) and certain values in `wp_options` are also dependent of this prefix value.  Fortunately it is really easy to fix:</p>
<ul>
<li><code>UPDATE `<strong>PREFIX</strong>_usermeta` SET `meta_key` = REPLACE( `meta_key` , 'wp_', '<strong>PREFIX</strong>_' );  -- Change <strong>PREFIX</strong>_ to your new prefix.</code></li>
<li><code>UPDATE `<strong>PREFIX</strong>_options` SET `option_name` = '<strong>PREFIX</strong>_user_roles' WHERE `option_name` = 'wp_user_roles' AND `blog_id` = 0; -- Change <strong>PREFIX</strong>_ to your new prefix.</code></li>
</ul>
<p>Execute those two lines of SQL (after you&#8217;ve replaced it with the proper prefix), and you&#8217;ll be ready to rock and roll again.  This is one of those odd little bits that they don&#8217;t explain anywhere in the manual &#8211; probably because most people don&#8217;t use anything other than the defaults&#8230; which brings us right back to the security concern (i.e. easy to guess/default password = bad).</p>
<p>Having keys in tables change because the table prefix is different is one of the stranger things done in a web application that I&#8217;ve worked with.  I can&#8217;t really think of a reason to do this, but I&#8217;m sure the developers had a good reason (as strange as it might be).  Fortunately this problem is easy enough to fix, but it certainly is frustrating when your admin user gets &#8220;<strong>You do not have sufficient permissions to access this page.</strong>&#8221; and you know better.</p>
]]></content:encoded>
			<wfw:commentRss>http://snowulf.com/2010/06/17/serendipity-to-wordpress-%e2%80%93-changing-table-prefix/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>DB2 LUW vs zOS: Selecting from nested subselect</title>
		<link>http://snowulf.com/2010/02/17/db2-luw-vs-zos-selecting-from-nested-subselect/</link>
		<comments>http://snowulf.com/2010/02/17/db2-luw-vs-zos-selecting-from-nested-subselect/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 18:00:00 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[db2]]></category>
		<category><![CDATA[luw]]></category>
		<category><![CDATA[zos]]></category>

		<guid isPermaLink="false">http://wp.snowulf.com/?p=765</guid>
		<description><![CDATA[SQL0104N An unexpected token &#8220;&#8221; was found following &#8220;&#8221;. Expected tokens may include: &#8220;CORRELATION NAME&#8221;. SQLSTATE=42601 This was the error that I got while attempting to execute a stored procedure under DB2 v8.1 for z/OS. Being quite confused about it, I googled for the answer. I didn&#8217;t find one, but I did find this google [...]]]></description>
			<content:encoded><![CDATA[<p>SQL0104N  An unexpected token &#8220;&#8221; was found following &#8220;&#8221;.  Expected tokens may include:  &#8220;CORRELATION NAME&#8221;.  SQLSTATE=42601</p>
<p>This was the error that I got while attempting to execute a stored procedure under DB2 v8.1 for z/OS.  Being quite confused about it, I googled for the answer.  I didn&#8217;t find one, but I did find this <a href="http://groups.google.com/group/comp.databases.ibm-db2/browse_thread/thread/d52aed754dd4cdfd">google groups post</a> which made mention of it.</p>
<p>Basically, the situation was that I had</p>
<p>SELECT COUNT(*) FROM<br />
(<br />
SELECT &#8230;<br />
UNION<br />
SELECT &#8230;<br />
)</p>
<p>And while that works just fine under LUW, z/OS doesn&#8217;t like it.  The simple solution is to add &#8220;AS TBL_1&#8243;, or any other name to the parenthetical subselect, which I have done below.  Both commands work just fine in LUW, but if you are working under z/OS (or at least version 8.1) you will need to use the bottom example.</p>
<p>SELECT COUNT(*) FROM<br />
(<br />
SELECT &#8230;<br />
UNION<br />
SELECT &#8230;<br />
) AS TBL_1</p>
]]></content:encoded>
			<wfw:commentRss>http://snowulf.com/2010/02/17/db2-luw-vs-zos-selecting-from-nested-subselect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In MySQL: x^y != x raised to the y</title>
		<link>http://snowulf.com/2008/11/17/in-mysql-xy-x-raised-to-the-y/</link>
		<comments>http://snowulf.com/2008/11/17/in-mysql-xy-x-raised-to-the-y/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 01:05:24 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[operators]]></category>
		<category><![CDATA[power]]></category>

		<guid isPermaLink="false">http://wp.snowulf.com/?p=537</guid>
		<description><![CDATA[As the title states, the caret (^) is not used as an exponent in MySQL. I&#8217;m not certain what exactly it does (and couldn&#8217;t find any documentation after a quick search), and would love to find out what its purpose is. I ran into this problem today when I noticed that MySQL&#8217;s math results (using [...]]]></description>
			<content:encoded><![CDATA[<p>As the title states, the <a title="Wikipedia: Caret" href="http://en.wikipedia.org/wiki/Caret#Uses_and_history">caret (^)</a> is not used as an exponent in MySQL.  I&#8217;m not certain what exactly it does (and couldn&#8217;t find any documentation after a quick search), and would love to find out what its purpose is.</p>
<p>I ran into this problem today when I noticed that MySQL&#8217;s math results (using ^) didn&#8217;t match my own.  After triple checking my own math, I added lots of parens and still got nowhere, so I checked the Operator Precedence and sure enough it listed the caret (^) as falling between &#8220;*, /, DIV, %, MOD&#8221; and &#8220;- (unary minus), ~ (unary bit inversion)&#8221;.  This made me think that surely I have a typo in my code somewhere since if the operator is mentioned it should be supported.  <strong>WRONG.</strong></p>
<p>Convinced that something had gone horribly awry I began to look through the other math function available and switched to using <strong>POW</strong> and <strong>SQRT</strong> which instantly remedied the problem.</p>
<p>After getting my equations working I began to try to find more information on the symbol that caused me so much frustration.  Alas, as mentioned above, I could find no specific information, other than some hints that it might be used for RegEx or as XOR, though after running the query below, I remain unconvinced.</p>
<blockquote><p>SELECT 1^0, 1^1, 1^2, 1^3, 1^4, 1^5, TRUE^FALSE, TRUE^TRUE, FALSE^FALSE, FALSE^TRUE</p>
<table border="1" cellspacing="1" cellpadding="0">
<tbody>
<tr>
<th>1^0</th>
<th>1^1</th>
<th>1^2</th>
<th>1^3</th>
<th>1^4</th>
<th>1^5</th>
<th>TRUE^FALSE</th>
<th>TRUE^TRUE</th>
<th>FALSE^FALSE</th>
<th>FALSE^TRUE</th>
</tr>
<tr>
<td>1</td>
<td>0</td>
<td>3</td>
<td>2</td>
<td>5</td>
<td>4</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>1</td>
</tr>
</tbody>
</table>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://snowulf.com/2008/11/17/in-mysql-xy-x-raised-to-the-y/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>From the &#8220;all-your-databases-are-belong-to-me&#8221; department&#8230;</title>
		<link>http://snowulf.com/2007/09/21/from-the-all-your-databases-are-belong-to-me-department/</link>
		<comments>http://snowulf.com/2007/09/21/from-the-all-your-databases-are-belong-to-me-department/#comments</comments>
		<pubDate>Fri, 21 Sep 2007 19:02:00 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Database Administrator]]></category>
		<category><![CDATA[DBA]]></category>
		<category><![CDATA[Information Technology]]></category>

		<guid isPermaLink="false">http://wp.snowulf.com/?p=426</guid>
		<description><![CDATA[I figured the best way to start this spot is with 4 ways for absolutely anyone to make their DBA’s life easier. Never start a conversation with “I just need this one thing, really quick”. This rule can be expanded to replace one with any given number. Reasoning: You are not a DBA and most [...]]]></description>
			<content:encoded><![CDATA[<p>I figured the best way to start this spot is with 4 ways for absolutely anyone to make their DBA’s life easier.</p>
<ol>
<li>Never start a conversation with “I just need this one thing, really quick”.  This rule can be expanded to replace one with any given number.
<ol type="a">
<li>Reasoning: You are not a DBA and most likely do not know what else the DBA is working on, it is much better to ask, “I have a couple things I need from you; do you have time to go over them now?”</li>
</ol>
</li>
<li>Don’t touch the development database(s).  EVER.  Seriously.  Your DBA is in charge of monitoring changes to the database(s) and making sure they (eventually) get pushed to production.  Unless you are given explicit permission by the DBA (and no, their higher ups or underlings do not count) do not attempt to modify ANY schema EVER.  Doing so can cause serious problems during an upgrade cycle as everyone tries to figure out why functionality that worked well in development is going haywire in production.</li>
<li>Don’t touch the production database(s). EVER.  I really shouldn’t even have to state this rule given its predecessor.  And yet, I have; why is that?  Because some people seem to think it is alright to do whatever they want to a production database, since it is, well,  <em>in production</em>.The logic, as I have had it explained to me is as follows: “Once [the database] is in production, what do you care what happens to it?  You don’t have to monitor changes to it; you just have to make sure it gets backed up properly, so that if a customer breaks something we can roll back.”
<p>This is a serious problem.</p>
<p>Let’s use a little example:  A customer calls in and requests some changes.  Bob, being the genius that he is, realizes that he has access to the production database of the customer in question (for some reason known only to IT) and decides that in his infinite wisdom he will make the changes to the customer’s database and drop a line (something akin to: “FYI: I made some changes to database xyz”) to the DBA afterwards.</p>
<p>There is nothing more frightening to a DBA to see than an email from someone who thinks they know what they are doing than that.  In the aforementioned example, Bob has not actually performed the changes to the correct database.  He has in fact changed another customer’s database.  This other customer is now quite upset that something has gone horribly awry and demands a fix.  The DBA now has a choice to make:</p>
<ol type="A">
<li>Talk with Bob and try to pin down exactly what he did.  Sadly, this choice often leads to the following conversation:<br />
<span style="text-decoration: underline;">DBA:</span> You made changes to the wrong database.  I need to know EXACTLY what you did.<br />
<span style="text-decoration: underline;">Bob:</span> Oh you know, just this and that.  Added some columns, dropped some columns that sort of thing.  Don’t you have monitoring software to record stuff like that?<br />
<span style="text-decoration: underline;">DBA:</span> Let me get this straight, you made schema changes and didn’t bother to save the script?<br />
<span style="text-decoration: underline;">Bob:</span> What’s a script?</li>
<li>Restore from a previous backup.  This of course causes the customer to lose out on any data from after the backup was performed, but is much faster to do.  If it is an important customer, then the DBA can script some of the data over from whichever tables they were using, however this will take time.  This of course results in angry customers.  Plus, the first customer still hasn’t had his changes made.</li>
</ol>
</li>
<li>Script everything.  It doesn’t matter if you are ignoring 2 and 3, or if you have been given explicit permission from the DBA.  If you make modifications to a database, especially for schema, script it all out.  Your DBA will thank you for it.  It makes things so much easier.</li>
</ol>
<p>Lastly, just for you IT folks out there, the number one way you can make your DBA’s life easier right this very second.</p>
<p><strong>Revoke access to the databases from EVERYONE, but the DBA.</strong><br />
Yeah, I know, not going to happen, but a DBA can dream, right?</p>
]]></content:encoded>
			<wfw:commentRss>http://snowulf.com/2007/09/21/from-the-all-your-databases-are-belong-to-me-department/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
