<?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>gregs &#187; database</title>
	<atom:link href="http://gregs.tcias.co.uk/category/comps/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://gregs.tcias.co.uk</link>
	<description>helping me remember what I figure out</description>
	<lastBuildDate>Sun, 05 Sep 2010 08:45:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=abc</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Upgrading to Lenny</title>
		<link>http://gregs.tcias.co.uk/2010/03/09/upgrading-to-lenny/</link>
		<comments>http://gregs.tcias.co.uk/2010/03/09/upgrading-to-lenny/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 06:52:56 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[*nix]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linode]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=481</guid>
		<description><![CDATA[It's been  while since I attended to my VPS, I decided to spend some time last night upgrading my distribution from Etch to Lenny. This is normally a moment where your heart sinks as quite a few things do tend to go belly up, but I am happy to report that I only came [...]]]></description>
			<content:encoded><![CDATA[<p>It's been  while since I attended to my VPS, I decided to spend some time last night upgrading my distribution from Etch to Lenny. This is normally a moment where your heart sinks as quite a few things do tend to go belly up, but I am happy to report that I only came across some minor issues and these were resolved in minutes as opposed to hours.</p>
<ol>
<li>MySQL : failed to start, complaining about:
<div class="igBar"><span id="lcode-4"><a href="#" onclick="javascript:showPlainTxt('code-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-4">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/etc/init.<span style="">d</span>/mysql: ERROR: Using expire_logs_days without log_bin crashes</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">the server. <span style="">See</span> README.<span style="">Debian</span>.<span style="">gz</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Commenting out the expire_logs_days in the my.cnf file allowed me to restart MySQL.</li>
<li>After the upgrade of Apache, my virtual hosts weren't working. A quick search via Google <a href="http://www.pc-freak.net/blog/solution-to-a-problem-with-virtualhosts-on-debian-lenny-default-virtualhost-opening-by-default-overwritting-the-rest-of-the-configured-virtualhosts/">pointed me to this post</a> - a quick edit of all of my host files and it was all working again.</li>
<li>the php-mysql connector somehow hadn't been upgraded/installed so a quick
<div class="igBar"><span id="lcode-5"><a href="#" onclick="javascript:showPlainTxt('code-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-5">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">apt-get install php5-mysql </div>
</li>
</ol>
</div>
</div>
</div>
<p>fixed that problem.</li>
<li>OpenBD : the only thing that remains broken was my tomcat5.5 Open BD install. Tomcat was working fine but Open BD refused to start up complaining about :
<div class="igBar"><span id="lcode-6"><a href="#" onclick="javascript:showPlainTxt('code-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-6">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">javax.<span style="">servlet</span>.<span style="">ServletException</span>: Open BlueDragon Engine Failed to initialise tags: java.<span style="">awt</span>.<span style="">Color</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>Since I am not really using it, it's not that important, but at some stage I'd like to get it working again. If you have any suggestions, please leave a comment.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2010/03/09/upgrading-to-lenny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL to XML</title>
		<link>http://gregs.tcias.co.uk/2007/08/29/sql-to-xml/</link>
		<comments>http://gregs.tcias.co.uk/2007/08/29/sql-to-xml/#comments</comments>
		<pubDate>Wed, 29 Aug 2007 05:12:45 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[MS SQL]]></category>

		<guid isPermaLink="false">http://gregs.teacupinastorm.com/?p=455</guid>
		<description><![CDATA[Just came across this neat trick that uses SQL to generate XML on the fly:
PLAIN TEXT
CODE:




DECLARE @x xml


SET @x=&#40;select geoAreaCode


, geoLevelCode


, geoLevelId


, geoAreaId


from tbl_geoLevel


where uuid =


for xml raw&#40;'geoArea'&#41;, root&#40;'geoAreas'&#41;, type&#41;


SELECT @x AS geoAreaInfo 






The above will create an XML structure that has a root value of geoAreas and child elements of geoArea for each row [...]]]></description>
			<content:encoded><![CDATA[<p>Just came across this neat trick that uses SQL to generate XML on the fly:</p>
<div class="igBar"><span id="lcode-8"><a href="#" onclick="javascript:showPlainTxt('code-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-8">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DECLARE @x xml</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SET @x=<span style="color:#006600; font-weight:bold;">&#40;</span>select geoAreaCode</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">, geoLevelCode</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">, geoLevelId</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">, geoAreaId</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">from tbl_geoLevel</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">where uuid =</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">for xml raw<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'geoArea'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, root<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'geoAreas'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, type<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SELECT @x AS geoAreaInfo </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>The above will create an XML structure that has a root value of geoAreas and child elements of geoArea for each row found.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2007/08/29/sql-to-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beyond SQL injection attacks</title>
		<link>http://gregs.tcias.co.uk/2006/11/23/beyond-sql-injection-attacks/</link>
		<comments>http://gregs.tcias.co.uk/2006/11/23/beyond-sql-injection-attacks/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[MS SQL]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=157</guid>
		<description><![CDATA[Courtesy of Slashdot a reminder that you should also worry about other types of injection attacks. Don't you just wish that everybody would play nice?
UPDATE
In a similar vein, Nadav Samet covers off in more detail Cross Site Scripting attacks, how they work and what you can do to protect your site.
]]></description>
			<content:encoded><![CDATA[<p>Courtesy of Slashdot a reminder that you should also worry about <a title="Malicious Code Injection: It's Not Just for SQL Anymore" href="http://www.site-reference.com/articles/Website-Development/Malicious-Code-Injection-It-s-Not-Just-for-SQL-Anymore.html">other types of injection attacks</a>. Don't you just wish that everybody would play nice?</p>
<p>UPDATE</p>
<p>In a similar vein, Nadav Samet <a title="Prepare for Attack!â€”Making Your Web Applications More Secure" href="http://www.thesamet.com/blog/2007/01/16/prepare-for-attack%e2%80%94making-your-web-applications-more-secure/">covers off in more detail</a> Cross Site Scripting attacks, how they work and what you can do to protect your site.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2006/11/23/beyond-sql-injection-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LogParser</title>
		<link>http://gregs.tcias.co.uk/2006/11/23/logparser/</link>
		<comments>http://gregs.tcias.co.uk/2006/11/23/logparser/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[MS SQL]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[parse]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=140</guid>
		<description><![CDATA[Charlie Arehart has a handy little article published in this months CFDJ on using Microsoft's Log Parser tool, which allows you to write SQL like statements against your CFMX log files. Couldn't find a publicly accessible link, but if you keep an eye on his articles page, I am sure he'll update it as soon [...]]]></description>
			<content:encoded><![CDATA[<p>Charlie Arehart has a handy little article published in this months CFDJ on using <a title="Download Details: Log Parser 2.2" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en">Microsoft's Log Parser tool</a>, which allows you to write SQL like statements against your CFMX log files. Couldn't find a publicly accessible link, but if you keep an eye on his <a title="Articles by Charlie Arehart" href="http://carehart.org/articles.cfm">articles page</a>, I am sure he'll update it as soon as it is available.</p>
<h4>Update</h4>
<p>Charlie dropped me a note last week to let me know that the article can be found <a title="Monitoring Your ColdFusion Environment With the Free Log Parser Toolkit" href="http://coldfusion.sys-con.com/read/296223.htm">on-line here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2006/11/23/logparser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AUTO INCREMENT</title>
		<link>http://gregs.tcias.co.uk/2006/06/29/auto-increment/</link>
		<comments>http://gregs.tcias.co.uk/2006/06/29/auto-increment/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=162</guid>
		<description><![CDATA[Since the MySQL Query Browser on my Mac refused to let me set a field as auto increment through the GUI, here's how you can using SQL change an existing column to use auto_increment:
PLAIN TEXT
SQL:




ALTER TABLE `aggregatedWeekly` CHANGE `Id` `Id` INT&#40; 6 &#41; UNSIGNED NOT NULL AUTO_INCREMENT 






UPDATE
I have also recently found out that the [...]]]></description>
			<content:encoded><![CDATA[<p>Since the MySQL Query Browser on my Mac refused to let me set a field as auto increment through the GUI, here's how you can using SQL change an existing column to use auto_increment:</p>
<div class="igBar"><span id="lsql-11"><a href="#" onclick="javascript:showPlainTxt('sql-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-11">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`aggregatedWeekly`</span> <span style="color: #993333; font-weight: bold;">CHANGE</span> <span style="color: #ff0000;">`Id`</span> <span style="color: #ff0000;">`Id`</span> INT<span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color: #cc66cc;color:#800000;">6</span> <span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>UPDATE</h4>
<p>I have also recently found out that the following works just as well:</p>
<p><code>
<div class="igBar"><span id="lsql-12"><a href="#" onclick="javascript:showPlainTxt('sql-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">SQL:</span>
<div id="sql-12">
<div class="sql">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #993333; font-weight: bold;">ALTER</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`aggregatedWeekly`</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span>=<span style="color: #cc66cc;color:#800000;">1</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2006/06/29/auto-increment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CFMX &#8211; MSDE connection refused error</title>
		<link>http://gregs.tcias.co.uk/2005/12/16/cfmx-msde-connection-refused-error/</link>
		<comments>http://gregs.tcias.co.uk/2005/12/16/cfmx-msde-connection-refused-error/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[MS SQL]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=156</guid>
		<description><![CDATA[I just started using MSDE for local development again and after creating my first DSN through the ColdFusion administrator I encountered the following problem:
PLAIN TEXT
CODE:




# Connection verification failed for data source: SMS


java.sql.SQLException: &#91;Macromedia&#93;&#91;SQLServer JDBC Driver&#93;Error establishing socket. Connection refused: connect


The root cause was that: java.sql.SQLException: &#91;Macromedia&#93;&#91;SQLServer JDBC Driver&#93;Error establishing socket. Connection refused: connect 






First thing [...]]]></description>
			<content:encoded><![CDATA[<p>I just started using MSDE for local development again and after creating my first DSN through the ColdFusion administrator I encountered the following problem:</p>
<div class="igBar"><span id="lcode-15"><a href="#" onclick="javascript:showPlainTxt('code-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-15">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># Connection verification failed for data source: SMS</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">java.<span style="">sql</span>.<span style="">SQLException</span>: <span style="color:#006600; font-weight:bold;">&#91;</span>Macromedia<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>SQLServer JDBC Driver<span style="color:#006600; font-weight:bold;">&#93;</span>Error establishing socket. <span style="">Connection</span> refused: connect</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">The root cause was that: java.<span style="">sql</span>.<span style="">SQLException</span>: <span style="color:#006600; font-weight:bold;">&#91;</span>Macromedia<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>SQLServer JDBC Driver<span style="color:#006600; font-weight:bold;">&#93;</span>Error establishing socket. <span style="">Connection</span> refused: connect </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>First thing I checked (well second after making sure I had provided the right connection details) was to see if anything was listening port on port 1433 by using the handy "netstats -a" command. And there wasn't, so a quick Google search turned up<a href="http://www.robisen.com/index.cfm?mode=entry&amp;entry=BE1AB594-55DC-F2B1-F392552E0A41542A"> this gem from Robi Sen</a>. Sadly this tool didn't help me as apparently my version didn't need it, but a comment did point me to <a href="http://support.microsoft.com/kb/841251/" title="How to enable SQL Server connectivity on Windows XP Service Pack 2">a another link</a>. But sadly it didn't help me either, but the comment did give me an idea. When I went to check my network set up for MS SQL server, sure enough TCP/IP was not listed... What followed was a moment of banging my head sharply on the table.</p>
<p>Right changes applied, restarted the server, verify connection and...</p>
<div class="igBar"><span id="lcode-16"><a href="#" onclick="javascript:showPlainTxt('code-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-16">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Connection verification failed for data source: SMS</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">java.<span style="">sql</span>.<span style="">SQLException</span>: <span style="color:#006600; font-weight:bold;">&#91;</span>Macromedia<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>SQLServer JDBC Driver<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>SQLServer<span style="color:#006600; font-weight:bold;">&#93;</span>Login failed for user <span style="color:#CC0000;">'hermes'</span>. <span style="">Reason</span>: Not associated with a trusted SQL Server connection.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">The</span> root cause was that: java.<span style="">sql</span>.<span style="">SQLException</span>: <span style="color:#006600; font-weight:bold;">&#91;</span>Macromedia<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>SQLServer JDBC Driver<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#91;</span>SQLServer<span style="color:#006600; font-weight:bold;">&#93;</span>Login failed for user <span style="color:#CC0000;">'yourUsername'</span>. <span style="">Reason</span>: Not associated with a trusted SQL Server connection. </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Well this one only took a few seconds to fix: <a href="http://www.banmanpro.com/support/sql2k.asp" title="Login Failed for User 'BanManProSQL', Not Associated with a trusted SQL Server Connection.">Windows Authentication only was enabled</a>! Simply open the properties of your server once more, check the security tab and you should see that the option for Windows Authentication is selected. Just change that to SQL server and Windows and you are ready to go...</p>
<p>I guess this is very much a case of damned if you do and damned if you don't for Microsoft as they seemed to have tightened up the security for MS SQL server (I won't even go into the nuisance of trying to install MSDE and being prompted to set an SA password before starting with no indication how to do so), but surely we should be given the option at install time to set these things? Or maybe it's just the MSDE?</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2005/12/16/cfmx-msde-connection-refused-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>LIKE and Oracle</title>
		<link>http://gregs.tcias.co.uk/2005/10/21/like-and-oracle/</link>
		<comments>http://gregs.tcias.co.uk/2005/10/21/like-and-oracle/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=152</guid>
		<description><![CDATA[I never spotted this before but the LIKE operator is case sensitive! Which was skewing my search results quite severely. The work around is to put everything into upper case, both the values in the column you are performing the search against as well as the value of the varibale you are searching for.
PLAIN TEXT
CODE:




SELECT [...]]]></description>
			<content:encoded><![CDATA[<p>I never spotted this before but the LIKE operator is case sensitive! Which was skewing my search results quite severely. The work around is to put everything into upper case, both the values in the column you are performing the search against as well as the value of the varibale you are searching for.</p>
<div class="igBar"><span id="lcode-18"><a href="#" onclick="javascript:showPlainTxt('code-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-18">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SELECT col1, col2, col3</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FROM table</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">WHERE UPPER<span style="color:#006600; font-weight:bold;">&#40;</span>col4<span style="color:#006600; font-weight:bold;">&#41;</span> LIKE <span style="color:#CC0000;">'%UPPER(yourValue)%'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2005/10/21/like-and-oracle/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updates from a select</title>
		<link>http://gregs.tcias.co.uk/2003/10/20/updates-from-a-select/</link>
		<comments>http://gregs.tcias.co.uk/2003/10/20/updates-from-a-select/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[MS SQL]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=432</guid>
		<description><![CDATA[I have been doing a lot more database based work recently and have learned one or two pretty useful techniques. Here is an extremely useful one: Running an update based on a select statement.
In the past whenever I could have wanted to do a bulk update on a table based on certain criteria, I would [...]]]></description>
			<content:encoded><![CDATA[<p>I have been doing a lot more database based work recently and have learned one or two pretty useful techniques. Here is an extremely useful one: Running an update based on a select statement.</p>
<p>In the past whenever I could have wanted to do a bulk update on a table based on certain criteria, I would have run a select statement to retrieve a bunch of columns first and then programmatically looped over the result set and updated the values. But there is a much, much easier and way more efficient way of doing this. Just take a quick look at the statement below.</p>
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showPlainTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">UPDATE someUsersTable</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">SET someUsersTable.<span style="">EmailPrivate</span> = someOtherJoinTable.<span style="">PublicEmail</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FROM someUsersTable INNER JOIN someOtherJoinTable ON someUsersTable.<span style="">userID</span> = someOtherJoinTable.<span style="">userID</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">WHERE <span style="color:#006600; font-weight:bold;">&#40;</span>tbl_Users.<span style="">userEmailPrivate</span> = <span style="color:#CC0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>It was constructed very much the way I would have normally approached the problem. First I wrote the select statement in Query Analyzer, i.e. <em>SELECT * FROM FROM someUsersTable INNER JOIN someOtherJoinTable ON someUsersTable.userID = someOtherJoinTable.userID WHERE (tbl_Users.userEmailPrivate = '')</em>. This gave me the result set I wanted to work with. Next I quite simply removed the SELECT statement replaced it with a corresponding UPDATE statement. So easy when you know how and the performance should be way better than before hand, because rather than making multiple trips back and forth to the database server from the web application it's all handled by the database server in one swoop!</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2003/10/20/updates-from-a-select/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing a dB on a remote server</title>
		<link>http://gregs.tcias.co.uk/2000/10/18/accessing-a-db-on-a-remote-server/</link>
		<comments>http://gregs.tcias.co.uk/2000/10/18/accessing-a-db-on-a-remote-server/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=296</guid>
		<description><![CDATA[Some of the information we wanted to publish on  my previous company's intranet was residing on databases that weren't on the main web server. This initially caused a little headache as we really needed to access that data on the remote NT server and publish it. So how do you get around that problem??
Well [...]]]></description>
			<content:encoded><![CDATA[<p>Some of the information we wanted to publish on  my previous company's intranet was residing on databases that weren't on the main web server. This initially caused a little headache as we really needed to access that data on the remote NT server and publish it. So how do you get around that problem??</p>
<p>Well the solution to that problem turns out to be incredibly simple. I maped a drive to our web server to the share where the database was held. Then I started up the Cold Fusion Administrator and created a datasource for that database (Db) and went through the process in the normal manner. You'll notice that once you browse for that Db that you can't see the mapped drive. So go back to the previous screen and enter the path manually, something like this:</p>
<p>[code]<br />
{drive letter}\:{share name}\{directory or file name}<br />
[\code]</p>
<p>That's pretty much it. You can now safely create the datasource. Should the Verification process fail go to the advanced properties section of the datasource properties, you may have to specify a user account with sufficient permissions to access that share, i.e. create a CF service account with sufficient permissions and that should do the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2000/10/18/accessing-a-db-on-a-remote-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring MyODBC on NT</title>
		<link>http://gregs.tcias.co.uk/2000/10/17/configuring-myodbc-on-nt/</link>
		<comments>http://gregs.tcias.co.uk/2000/10/17/configuring-myodbc-on-nt/#comments</comments>
		<pubDate>Wed, 30 Nov -0001 00:00:00 +0000</pubDate>
		<dc:creator>gregs</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://gregs.tcias.co.uk/?p=285</guid>
		<description><![CDATA[This is effectively part II of configuring MySQL for NT. With the help of this document you will be able to access your MySQL database server from other Windows applications (e.g. Cold Fusion). Right so let's get started. We shall begin with installing MyODBC (a copy of which can be obtained from here http://www.mysql.com/downloads/api-myodbc.html).
Installing MyODBC [...]]]></description>
			<content:encoded><![CDATA[<p>This is effectively part II of configuring MySQL for NT. With the help of this document you will be able to access your MySQL database server from other Windows applications (e.g. Cold Fusion). Right so let's get started. We shall begin with installing MyODBC (a copy of which can be obtained from here <a href="http://www.mysql.com/downloads/api-myodbc.html">http://www.mysql.com/downloads/api-myodbc.html</a>).</p>
<p>Installing MyODBC is straightforward. Unzip the downloaded file and click on the <strong>setup.exe</strong> file and simply follow the installation prompts. For starters just keep accepting the default settings if you are unsure of any options.</p>
<p>OK, now we are ready to add a <strong>MySQL</strong> datasource. You have to do this through <em>ODBC datasources</em> in the <strong>Control Panel</strong>. Please note: if you were planning on using the Cold Fusion Administrator, you can't. You have to go through the <strong>Control Panel</strong> to initially configure the datasource. Once setup you can modify your <strong>MySQL</strong> datasources through the Cold Fusion Administrator. So go ahead and fire up your ODBC manager.</p>
<p>Once open, go to the the <strong>system DNS</strong> tab and select <em>Add...</em>. From the list of available drivers select <strong>MySQL</strong> and click <em>Finish</em>. This should fire up a dialogue with a whole bunch of fields. Listed below is a sample entry:</p>
<div class="igBar"><span id="lcode-22"><a href="#" onclick="javascript:showPlainTxt('code-22'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-22">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Windows DNS name: mydsn</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MySQL host <span style="color:#006600; font-weight:bold;">&#40;</span>name or ip<span style="color:#006600; font-weight:bold;">&#41;</span>: <span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MySQL database name: mydatabase</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">User: myusername</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Password: mypassword </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Things to bear in mind are: from my personal experience, I found that it's best to keep windows DSN and database name in lower case. Specifying the IP address works, I have had problems using the host name setting. As for the username and password, make sure that you use those properties that you set to the database you created. I.e. if you don't require a logon to connect to that database, then leave the fields blank. Else enter the username and password assigned to that database (the default <strong>root</strong> account will work well, but is contentious for security reasons).</p>
<p>Well we are done you should know have configured your system to connect to a MySQL database via ODBC.</p>
]]></content:encoded>
			<wfw:commentRss>http://gregs.tcias.co.uk/2000/10/17/configuring-myodbc-on-nt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
