<?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>Docile Tree &#187; dbd</title>
	<atom:link href="http://www.dociletree.co.za/tag/dbd/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dociletree.co.za</link>
	<description>Aubrey Kilian explains, rants and raves</description>
	<lastBuildDate>Fri, 21 May 2010 11:44:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Perl, FreeTDS and Cron issues</title>
		<link>http://www.dociletree.co.za/perl-freetds-and-cron-issues/</link>
		<comments>http://www.dociletree.co.za/perl-freetds-and-cron-issues/#comments</comments>
		<pubDate>Fri, 11 Apr 2008 13:48:31 +0000</pubDate>
		<dc:creator>aubrey</dc:creator>
				<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[dbd]]></category>
		<category><![CDATA[freetds]]></category>
		<category><![CDATA[mssql]]></category>
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://www.dociletree.co.za/?p=9</guid>
		<description><![CDATA[While converting some dodgy nagios-commands into cron scripts today, I came across an age-old issue when scheduling the final script in cron: The script works perfectly when running it on the command-line, but fails miserably when cron runs it. The usual answer here is &#8220;Check the environment variables&#8221;. The error I was getting was from [...]]]></description>
			<content:encoded><![CDATA[<p>While converting some dodgy nagios-commands into cron scripts today, I came across an age-old issue when scheduling the final script in cron:  The script works perfectly when running it on the command-line, but fails miserably when cron runs it.</p>
<p>The usual answer here is &#8220;Check the environment variables&#8221;.</p>
<p>The error I was getting was from perl&#8217;s DBD library when trying to connect to the MSSQL database:</p>
<blockquote><p>failed: (DBD: dbd_db_login/SQLSetConnectOption err=-2)</p></blockquote>
<p>Hunting around I wasn&#8217;t 100% sure what environment variables I needed.<br />
Turns out we&#8217;re using <a href="http://www.freetds.org/">FreeTDS</a> to get Linux to talk to an MSSQL server.</p>
<p>I tried several of the environment variables I found in my shell&#8217;s environment, and a mix of several, and as it turns out I was missing only one:</p>
<blockquote><p>PERL_DL_NONLAZY=1</p></blockquote>
<p>Seems the previous Windows Admin Guy came across the same problem, didn&#8217;t document it anywhere, but did add the variable to the Linux machine&#8217;s global profile.  This worked while Nagios was calling the perl-script, but cron runs with a nice clean environment, so didn&#8217;t help there.<br />
So just export the PERL_DL_NONLAZY variable before you run your perl-script, and voila, there it is.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dociletree.co.za/perl-freetds-and-cron-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
