<?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>UseStrict Consulting &#187; Oracle</title>
	<atom:link href="http://usestrict.net/category/oracle/feed/" rel="self" type="application/rss+xml" />
	<link>http://usestrict.net</link>
	<description>Professional IT Solutions &#38; Training</description>
	<lastBuildDate>Sat, 07 Jan 2012 14:05:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Perl: Installing DBD::Oracle + Oracle Instant Client on Ubuntu 9.04</title>
		<link>http://usestrict.net/2009/07/perl-installing-dbdoracle-on-ubuntu-904-and-oracle-instant-client/</link>
		<comments>http://usestrict.net/2009/07/perl-installing-dbdoracle-on-ubuntu-904-and-oracle-instant-client/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 16:17:20 +0000</pubDate>
		<dc:creator>vinny</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Accept]]></category>
		<category><![CDATA[article material]]></category>
		<category><![CDATA[course]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[dbd]]></category>
		<category><![CDATA[dbd::oracle]]></category>
		<category><![CDATA[dbi]]></category>
		<category><![CDATA[distro]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[dpkg]]></category>
		<category><![CDATA[everything]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[gazillion times]]></category>
		<category><![CDATA[home directory]]></category>
		<category><![CDATA[Install]]></category>
		<category><![CDATA[Instant]]></category>
		<category><![CDATA[laptop]]></category>
		<category><![CDATA[LIBRARY]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[nbsp]]></category>
		<category><![CDATA[oracle db]]></category>
		<category><![CDATA[oracle distribution]]></category>
		<category><![CDATA[Oracle Instant Client]]></category>
		<category><![CDATA[perl 5]]></category>
		<category><![CDATA[perl mcpan]]></category>
		<category><![CDATA[pre requisites]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[root password]]></category>
		<category><![CDATA[rpm]]></category>
		<category><![CDATA[Set]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[Site]]></category>
		<category><![CDATA[sudo]]></category>
		<category><![CDATA[surprise]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[using oracle]]></category>
		<category><![CDATA[VirtualBox]]></category>
		<category><![CDATA[Windows XP]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://usestrict.net/?p=789</guid>
		<description><![CDATA[Easy to follow steps on how to install DBD::Oracle using Oracle Instant Client on Ubuntu 9.04]]></description>
			<content:encoded><![CDATA[<p>A couple of weeks ago I finally got a new laptop at work &#8211; which meant of course that I had to reinstall everything. Although we use Windows XP, there&#8217;s one app that I have to run through Linux. The solution was <a href="http://www.virtualbox.org/" target="_blank">Sun&#8217;s VirtualBox</a> running <a href="http://www.ubuntu.com/" target="_blank">Ubuntu 9.04</a>. When I tried to run the app, I realized that I still needed to install DBI and DBD::Oracle &#8211; which brings me to this article. Nothing better than a reinstall to generate article material <img src='http://usestrict.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>DBD::Oracle is usually a pain to install if you haven&#8217;t already done it a gazillion times. After that, it&#8217;s just an annoying itch. In this article I&#8217;ll cover installing DBD::Oracle using Oracle Instant Client, Ubuntu 9.04, and Perl 5.10. Since we&#8217;re using the Instant Client, you&#8217;ll need some Oracle DB you can connect to in order to do the testing. You can choose to skip testing altogether, but you might be into a surprise later.<span id="more-789"></span></p>
<p>&nbsp;</p>
<h2>DBI and DBD::Oracle</h2>
<p>Installing the <strong>DBI</strong> is always easy &#8211; regardless if you&#8217;re running Windows or Linux. Just follow the steps.</p>
<ol>
<li>Get root password if you don&#8217;t already have one: <code><strong><em>sudo passwd root</em></strong></code></li>
<li>Switch to root: <code><strong><em>su -</em></strong></code></li>
<li>Run CPAN: <code><em>perl -MCPAN -e shell</em></code></li>
<li>Check if DBI is already installed: <code><strong><em>m DBI</em></strong></code></li>
<li>If it&#8217;s not installed, install it: <code><strong><em>install DBI</em></strong></code></li>
</ol>
<p>That should do the trick for the DBI. The DBD::Oracle is a bit more complicated and we&#8217;ll just use CPAN to download it for us. The rest is manual.</p>
<ol>
<li>Check for DBD::Oracle: <code><strong><em>m DBD::Oracle</em></strong></code></li>
<li>Download it: <code><strong><em>get DBD::Oracle</em></strong></code></li>
<li>Exit CPAN: <code><strong><em>q</em></strong></code></li>
</ol>
<p>Now we should have the DBD::Oracle distribution downloaded to our CPAN build directory. If you don&#8217;t know where to find it, look for <code>.cpan</code> dir under your root home or (if you started CPAN for the first time doing <code>sudo</code> from your main user, look for it under your main user&#8217;s home directory). We&#8217;ll leave that distro aside for a moment and work on the other pre-requisites.</p>
<p>&nbsp;</p>
<h2>Oracle Instant Client</h2>
<p>Download the instant client packages you&#8217;ll need. I chose to download the RPMs and convert them to .deb files using <code>alien</code>. Oracle also provides .zip files if you don&#8217;t want to do it the <code>alien</code> way.</p>
<p><a href="http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html" target="_blank">Oracle Instant Client Download Site i386</a><br />
<a href="http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linux-amd64.html" target="_blank">Oracle Instant Client Download Site AMD64 32- and 64-bit</a></p>
<p>Accept the license agreement by clicking the Accept radio button. Since the i386 and amd64 files have different names, check the bold words in the file names to know which ones to download (the names below are for the i386 platform). Also, if you don&#8217;t have a user_id for Oracle, you&#8217;ll be prompted to register one once you click the link. It&#8217;s free of charge.</p>
<ul>
<li>oracle-instantclient11.1-<strong>basic</strong>-xx.x.x.x.x-x.i386.rpm</li>
<li>oracle-instantclient11.1-<strong>sqlplus</strong>-xx.x.x.x.x-x.i386.rpm</li>
<li>oracle-instantclient11.1-<strong>devel</strong>-xx.x.x.x.x-x.i386.rpm</li>
</ul>
<p>AMD64 has only zip files from what I could find, and they&#8217;re named a bit differently, too (remove the <span style="color: red;">32</span> for the 64-bit version:</p>
<ul>
<li>instantclient-<strong>basic</strong>-linuxAMD64-<span style="color: red;">32</span>-xx.x.x.x.x-yyyymmdd.zip</li>
<li>instantclient-<strong>sqlplus</strong>-linuxAMD64-<span style="color: red;">32</span>-xx.x.x.x.x-yyyymmdd.zip</li>
<li>instantclient-<strong>sdk</strong>-linuxAMD64-<span style="color: red;">32</span>-xx.x.x.x.x-yyyymmdd.zip</li>
</ul>
<p><em>Note: Extract the zips into a directory called instantclient and skip to the <strong>Set Up your Environment Variables</strong> section if you&#8217;re using the AMD64 or i386 zip files.</em></p>
<h2>Install alien and libaio</h2>
<p>Now is the time to install <code>alien</code>, which is an application that converts rpm files into .deb format to be used with <code>dpkg</code>. Instant Client also requires <code>libaio</code>. Both can be installed through the Synaptic Package Manager. Just open it, look for <code>alien</code>, mark it for install and do the same for <code>libaio</code> and <code>libaio-dev</code>. Once they&#8217;re installed, you&#8217;re good to move on to install the Instant Client. Just don&#8217;t forget to exit Synaptic Package Manager, since we&#8217;ll be using <code>dpkg</code> and it won&#8217;t work if Synaptic is open.</p>
<p>&nbsp;</p>
<h2>Install Oracle Instant Client</h2>
<p>First step to install Oracle Instant Client from rpm files is to convert them into .deb files. Do that with <code>alien</code> by running the following command (from a command line in the directory where you downloaded your RPMs):</p>
<p><code>$ sudo alien --scripts *.rpm</code></p>
<p>It takes a little while to run, so be patient. Once it&#8217;s complete, install the newly created .deb files:</p>
<p><code>$ dpkg -i *.deb</code></p>
<p>&nbsp;</p>
<h2>Set up your Environment Variables</h2>
<p>The nasty thing about rpm files is that it&#8217;s not always easy to know where the files were installed. If you opted for the zip file approach, your install will most definitely be different. For RPM install, add this to your <code>.bashrc</code> file (swap xx.x for your oracle version):</p>
<p><code><br />
export ORACLE_HOME=/usr/lib/oracle/xx.x/client<br />
export PATH=$PATH:$ORACLE_HOME/bin<br />
export LD_LIBRARY_PATH=$ORACLE_HOME/lib<br />
</code></p>
<p><strong>Update:</strong> If you get an ELFCLASS64 error, try setting LD_LIBRARY_PATH to $ORACLE_HOME/lib32 instead.</p>
<p>Reload your <code>.bashrc</code> file:<br />
<code>$. ~/.bashrc</code></p>
<p>Note: by default, Oracle Instant Client doesn&#8217;t come with a <code>tnsnames.ora</code> file or the directory structure where it&#8217;s usually found. We&#8217;ll have to create that ourselves -</p>
<p><code>$ mkdir -p $ORACLE_HOME/network/admin; touch $ORACLE_HOME/network/admin/tnsnames.ora</code></p>
<p>&nbsp;</p>
<h2>Install DBD::Oracle</h2>
<p>It&#8217;s time to finally install DBD::Oracle. Go to your CPAN build directory and <code>cd</code> into <code>DBD-Oracle-*</code>. As a user having the environment variable set from the previous section, run Makefile.PL portion.</p>
<p><code>$ perl Makefile.PL</code></p>
<p>There&#8217;s no need to set INC or LIB with the <code>alien</code> approach, but if you run into any issues, try giving Makefile.PL the path to your include dir for INC, and lib dir for LIB.</p>
<p>Next, run</p>
<p><code>$ make</code>.</p>
<p>It will raise a few warnings, but unless it exits with an error, you should be OK.</p>
<p>The next logical step is to run make test. However, this will undoubtedly fail unless you have a valid entry in your tnsnames.ora file. If you don&#8217;t, you can skip this test and hope that everything works later on. Otherwise, update your <strong>tnsnames.ora</strong> file with a valid entry, and set one more environment variable before running the test:</p>
<p><code>$ export ORACLE_USERID="user/passwd@tns_entry_name"</code><br />
<code>$ make test</code></p>
<p>This is usually the hardest part to pass with total success. Many things can go wrong. In my case, the valid entry I use doesn&#8217;t have full grants to the user I log in as. This always triggers an error on the create/access sequences portion of the testing. I simply ignore it nowadays &#8211; make sure you analyze your test results thoroughly before choosing to ignore the errors as well.</p>
<p>Now that the testing is over, simply run<br />
<code>$ make install</code><br />
as a super user and you&#8217;re all set!</p>
<p>&nbsp;</p>
<h3>Book suggestions:</h3>
<div style="text-align: center;"><script type="text/javascript">// <![CDATA[
    (function(){
        document.write('<script type="text/javascript" src="http://cb1.cronblocks.com//js/content.js?c=11&#038;t='+(Math.floor(new Date().getTime()/1000))+'&#038;s=client"><\/script>');
    })();
// ]]&gt;</script></div>
]]></content:encoded>
			<wfw:commentRss>http://usestrict.net/2009/07/perl-installing-dbdoracle-on-ubuntu-904-and-oracle-instant-client/feed/</wfw:commentRss>
		<slash:comments>67</slash:comments>
		</item>
		<item>
		<title>Perl: Connecting to an Oracle database WITHOUT having an installed client</title>
		<link>http://usestrict.net/2009/01/perl-connecting-to-an-oracle-database-without-having-an-installed-client/</link>
		<comments>http://usestrict.net/2009/01/perl-connecting-to-an-oracle-database-without-having-an-installed-client/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 03:41:28 +0000</pubDate>
		<dc:creator>vinny</dc:creator>
				<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[alternative]]></category>
		<category><![CDATA[archive tool]]></category>
		<category><![CDATA[array reference]]></category>
		<category><![CDATA[bastard]]></category>
		<category><![CDATA[BEGIN]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[CPAN]]></category>
		<category><![CDATA[day]]></category>
		<category><![CDATA[dbd::oracle]]></category>
		<category><![CDATA[dbi]]></category>
		<category><![CDATA[dbs]]></category>
		<category><![CDATA[ENV]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[fileName]]></category>
		<category><![CDATA[filenames]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[intention]]></category>
		<category><![CDATA[ip port]]></category>
		<category><![CDATA[lazy bastard]]></category>
		<category><![CDATA[libs]]></category>
		<category><![CDATA[oracle 10g client]]></category>
		<category><![CDATA[oracle client]]></category>
		<category><![CDATA[oracle database]]></category>
		<category><![CDATA[PAR]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[perl archive]]></category>
		<category><![CDATA[perl module]]></category>
		<category><![CDATA[Pretty]]></category>
		<category><![CDATA[quickie]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[subroutine]]></category>
		<category><![CDATA[SUM]]></category>
		<category><![CDATA[sun solaris sparc]]></category>
		<category><![CDATA[target machines]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[Unpack]]></category>
		<category><![CDATA[username]]></category>

		<guid isPermaLink="false">http://usestrict.net/?p=154</guid>
		<description><![CDATA[Using Perl to connect to a DB without having Oracle Client installed.]]></description>
			<content:encoded><![CDATA[<p>I started this post with the intention of having it be a quickie, just showing people how to connect to Oracle with Perl/DBI without having to have Oracle client or even Perl installed, but it&#8217;s not that simple.  So I decided to rewrite it with detailed instructions.</p>
<p>Here is a list of what I used:</p>
<p><strong>Machine:</strong> Sun Solaris SPARC on build and target machines<br />
<strong>Oracle:</strong> Oracle 10g client (build machine only)<br />
<strong>Perl:</strong> v. 5.10.0 (build machine only)<br />
<strong>Perl modules:</strong> <a href="http://search.cpan.org/~timb/DBI-1.607/DBI.pm" target="_blank">DBI (1.607)</a>, <a href="http://search.cpan.org/~pythian/DBD-Oracle-1.22/Oracle.pm" target="_blank">DBD::Oracle (1.22)</a>, <a href="http://search.cpan.org/~smueller/PAR-1.002/lib/PAR.pm" target="_blank">PAR (0.983)</a>, <a href="http://search.cpan.org/~rschupp/PAR-Packer-1.012/lib/pp.pm" target="_blank">pp (0.982)</a>, <a href="http://search.cpan.org/~nwclark/perl-5.8.9/lib/PerlIO.pm">PerlIO (1.04)</a> (build machine only)</p>
<p><span id="more-154"></span></p>
<p>&nbsp;</p>
<h2>How I did it:</h2>
<p>Being the <a href="http://wiki.preshweb.co.uk/doku.php?id=perl:virtues" target="_blank">lazy</a> bastard that I am, I decided to write a Perl module that would do my DBI connections for me once I supplied it the SID, username, and password. This module isn&#8217;t in CPAN, but you can probably find similar ones in there. Who knows maybe one day I&#8217;ll make it available to the public, but for now I will only explain how it works and show the tidbits I used to get it connecting without the Oracle client installed. Let&#8217;s call my module <strong>MyDB.pm</strong> (at the time of this writing, there is no MyDB.pm module in CPAN).</p>
<p><strong>MyDB.pm:</strong> exports one subroutine: <strong>connect()</strong>. <strong> connect()</strong> takes an array reference of 3 values: <em>SID</em>, <em>username</em>, <em>password</em>. It then uses the given SID to check against <strong>%configured_dbs</strong> and fetch hostname/IP,  port, and alternative SID. It then connects to the DBI. Pretty straight-forward.</p>
<p><strong>Oracle Client: </strong>You&#8217;ll need the Oracle Client installed in your build machine. Or not. As long as you have access to the following files (the example here is for 10.1 version &#8211; your filenames may vary): <strong>libclntsh.so.10.1</strong>, and <strong>libnnz10.so</strong>. These are the magic libs that we will carry along with us.</p>
<p><strong>PAR/pp:</strong> The Perl Archive Tool is a VERY handy module. It basically allows you to pack modules/files into a regular zip (renamed to .par) and even to create self extracting executables. It comes with tools such as parl to load those packages and deploy the scripts inside, or you can run it from inside a separate script to use your modules without having to install them in a specific path. Oh, and with the PAR self extracting executable, you can even bundle Perl core files and run it in a machine that doesn&#8217;t have Perl installed! Sweet, eh? pp is part of the PAR family &#8211; it&#8217;s thescript that does the creation of the par packages. One downside of PAR is that it creates potentially HUGE  packages. A simple hello world can be over 2Mb large. But that&#8217;s not a concern in this tutorial, since we will be getting rid of having to keep Oracle up to date in every single machine, changing environment variables and the such.</p>
<p>When running a PAR package, it calculates the MD5SUM of the file and creates a temporary directory under /var/tmp/par-<em>userId</em>/cache-<em>md5sum </em>(replace <em>userId</em> with the ID of the person running the file, and <em>md5sum</em> with the actual md5sum) . It then unpacks the contents of the PAR into that directory and sets some environment variables &#8211; some of which will tell Perl to check in there for modules.  However, it seems to not automatically extract the libs, so we have to modify MyDB.pm to have it behave appropriately.</p>
<h1><img class="alignnone size-full wp-image-8" title="spacer" src="http://usestrict.net/wp-content/uploads/2008/10/spacer1.gif" alt="spacer" width="10" height="20" /></h1>
<h2>Making MyDB.pm work when called in a PAR context</h2>
<p>Create a BEGIN block checking for <strong>$ENV{PAR_TEMP}</strong>. This is the value of the PAR temp directory where the files should be extracted. Since PAR creates zipped files, it offers a method to return an Archive::Zip  handler:</p>
<p style="padding-left: 60px;"><em>my $zip_handler = PAR::par_handle(&#8216;MyDB.par&#8217;)</em>;</p>
<p>Now you can use Archive::Zip methods to manipulate your .par file. I used the following code for my BEGIN block:</p>
<pre class="brush:perl">BEGIN {
	if ($ENV{PAR_TEMP}) {

		# Get $par_cache (easier to type than $ENV{PAR_TEMP})
		my $par_cache = $ENV{PAR_TEMP};

		# Get Zip handler
		my $par_file = PAR::handle("MyDB.par");

		# Set files to look for
		my %membersToFind = (’libclntsh.so.10.1’ =&gt;1,
							 ’libnnz10.so’ =&gt; 1 );

		# Unpack files
		for my $m ($par_file-&gt;members()) {

			# Get path/name of the zipped file
			my $fileName = $m-&gt;fileName();

			# Prepare to check if the libs
			# have already been extracted
			use Find::File;

			# Iterate through %membersToFind keys
			for my $k (keys %membersToFind) {

				# If zipped file is one of the keys...
				if ($fileName =~ /$k/) {

					# do nothing if the file has already been extracted
					next if find(sub { /$k/ or return 0 },$par_cache); 

					# ...then remove from hash (we’ll check the hash later)...
					delete $membersToFind{$k};

					# ... and unpack into $par_cache directory
					$par_file-&gt;extractMember($fileName,"$par_cache") ||
					warn ("Failed to extract $fileName n");

				}
			}
		}

		# Check to see if any of the files wasn’t unpacked because it wasn’t found
		if (scalar(keys %membersToFind) &gt; 0) {

			warn("The following file(s) could not be found in PAR file: " .  join(’,’,@{ keys %membersToFind }) ."n");

		}
	}
}</pre>
<p>So now MyDB.pm will know what to do if $ENV{PAR_TEMP} is set.  The next step is to generate the PAR file.</p>
<h1><img class="alignnone size-full wp-image-8" title="spacer" src="http://usestrict.net/wp-content/uploads/2008/10/spacer1.gif" alt="spacer" width="10" height="20" /></h1>
<h2>Creating the PAR package</h2>
<p>You&#8217;ll need a dummy perl script to pass to <strong>pp</strong>:</p>
<pre class="brush:shell">	$ echo "use MyDB;" &gt; dummy.pl</pre>
<p>and then create the PAR file. Make sure MyDB.pm and your oracle libs are in places where Perl can find it. I placed MyDB.pm in the same directory as dummy.pl, and set LD_LIBRARY_PATH to my $ORACLE_HOME/lib32 (if you&#8217;re using Instant Client, set it to $ORACLE_HOME/instantclient or wherever your instant client keeps the libs). The pp command is this (on a shell prompt):</p>
<pre class="brush:shell">
$ pp -z 9 -v 3 -p -d -o MyDB.par
	-X DBD::Proxy
	-X DBD::DBM
	-X DBD::File
	-X DBD::NullP
	-X DBD::Gofer
	-X DBD::Sponge
	-X DBD::ExampleP
	-X DBD::mysql
	-X DBD::Gofer::Policy::rush
	-X DBD::Gofer::Policy::classic
	-X DBD::Gofer::Policy::Base
	-X DBD::Gofer::Policy::pedantic
	-X DBD::Gofer::Transport::pipeone
	-X DBD::Gofer::Transport::Base
	-X DBD::Gofer::Transport::stream
	-X DBD::Gofer::Transport::null
	-X DBD::mysql::GetInfo
	-X DBD::Chart
	-X DBD::Chart::Plot
	-M MyDB
	-M PerlIO
	-l libclntsh.so.10.1
	-l libnnz10.so
        -l libociei.so   # for Oracle instant client users only! Thanks to Jonathon Robinson for the heads up. (see comments for details)
	dummy.pl</pre>
<p><strong>pp command explained</strong></p>
<p><strong>pp:</strong> the PAR packer script<br />
<strong>-z 9:</strong> maximum compression<br />
<strong>-v 3:</strong> maximum verbosity<br />
<strong>-p:</strong> create par file<br />
<strong>-d:</strong> dependent. This means it will not add the Perl interpreter to the bundle. This reduces its size, but makes it rely on either perl being installed in the target machine, or your script (the one that&#8217;s going to use MyDB) being PAR&#8217;d without the -d option.<br />
<strong>-0 MyDB.par:</strong> the filename to be used on output<br />
<strong>-X <em>module</em>:</strong> removes un-necessary modules. Read more about it <a href="http://search.cpan.org/~smueller/PAR-1.002/lib/PAR/FAQ.pod#The_resulting_files_are_huge!_How_can_I_reduce_the_size_of_the_output_file?" target="_blank">here</a>.<br />
<strong>-M <em>module</em>:</strong> the modules you want to add (PAR sometimes misses a module during its dependency scan).  PerlIO is required.<br />
<strong>-l <em>lib</em>:</strong> adds the additional libs<strong><br />
dummy.pl:</strong> last item of the command, tells <strong>pp</strong> what the main script is.<br />
There &#8211; after lots of output on the screen, you should have a pretty large MyDB.par (at least 7Mb). Now we have to alter our main script (the one that <em>use</em>s MyDB in the first place) to have it handle the PAR file. Add the following lines right after your <em>use strict;</em> line (you DO use strict, RIGHT?!).</p>
<pre class="brush:perl">
          use PAR './MyDB.par';
          use MyDB;
          # the rest is business as usual
</pre>
<p>Once altered, you can choose to <strong>pp</strong> your script to have it run without a perl interpreter on another machine. This might take several attempts, since you will have to test the executable a few times to make sure you got all your modules bundled. The basic pp command though is this:</p>
<pre class="brush:shell">
       $ pp -z 9 -v 3 -o yourscript.exe yourscript.pl    # .exe not required
</pre>
<p>Here the absense of -d makes it assume -B which bundles Perl inside the executable. As mentioned before, you might need to add some -M <em>module</em> parameters before yourscript.pl to catch any missing modules.</p>
<h2>Running the scripts</h2>
<p>To run the scripts, just send them to the target machine and execute <em>yourscript.exe</em>. It will fetch MyDB.par in the same directory, extract it to $ENV{PAR_TEMP} the first time (so it might be a little slow at first) and carry on with its logic.</p>
<h2>Caveat</h2>
<p>I strongly advise that you delete your par_cache directory between rebuilds (while testing). The reason for this is that the cache will be created by the execution of <em>yourscript.exe</em> and NOT by MyDB.par. When this happens and you alter MyDB.par, the changes will not be reflected when you run <em>yourscript.exe</em>.</p>
<p>If you liked this post, please leave a comment. If you didn&#8217;t, leave a comment too! <img src='http://usestrict.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;d like to know what people think of my blog and ways to improve it.</p>
<p>&nbsp;</p>
<h3>Book Suggestions:</h3>
<div>
<script type="text/javascript">
    (function(){
        document.write('<script type="text/javascript" src="http://cb1.cronblocks.com//js/content.js?c=11&#038;t='+(Math.floor(new Date().getTime()/1000))+'&#038;s=client"><\/script>');
    })();
</script>
</div>
]]></content:encoded>
			<wfw:commentRss>http://usestrict.net/2009/01/perl-connecting-to-an-oracle-database-without-having-an-installed-client/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>DBD::Oracle + Cygwin: Undefined reference error during make</title>
		<link>http://usestrict.net/2009/01/dbdoracle-cygwin-error-during-make/</link>
		<comments>http://usestrict.net/2009/01/dbdoracle-cygwin-error-during-make/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 20:57:14 +0000</pubDate>
		<dc:creator>vinny</dc:creator>
				<category><![CDATA[Cygwin]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dbd::oracle]]></category>
		<category><![CDATA[dbi]]></category>
		<category><![CDATA[_OCILobGetChunkSize]]></category>
		<category><![CDATA[_OCINlsCharSetIdToName]]></category>

		<guid isPermaLink="false">http://usestrict.net/?p=138</guid>
		<description><![CDATA[Yesterday I found myself in a position of having to re-master my computer &#8211; hence having to reinstall most of the applications including my trusty Cygwin &#8211; which always becomes somewhat of a headache when I reach the point of installing DBD::Oracle in it. This time I got a undefined symbol error. A quick look [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I found myself in a position of having to re-master my computer &#8211; hence having to reinstall most of the applications including my trusty Cygwin &#8211; which always becomes somewhat of a headache when I reach the point of installing DBD::Oracle in it.</p>
<p>This time I got a undefined symbol error. A quick look in <a href="http://www.nntp.perl.org/group/perl.dbi.users/2008/09/msg33238.html" target="_blank">Google</a> showed me that Erik Squires had the same exact problem. Lots of searching later, I find that Google can&#8217;t find a handy solution anywhere&#8230; So I send Erik an email asking about the solution and to my surprise, he answers only 1 (!!)  minute after I click send. Talk about a fast reply!!</p>
<p>Hats off to Erik! You will find the solution here: http://cpae.typepad.com/capacity_planning_and_eng/</p>
<p><strong>Hint:</strong> the <em>oci.def</em> that he mentions in his post is inside your DBD::Oracle build directory. Don&#8217;t get it confused with ocidef.h file in your $ORACLE_HOME/oci/include directory (that&#8217;s where I looked first).</p>
<p>I&#8217;m adding the error message below with a big SOLUTION header for any Googler out there having the same problem. No need to keep reading if the text above was enough to solve your problem.</p>
<p><span id="more-138"></span></p>
<p>Oracle 10g + DBD::Oracle + Cygwin issue</p>
<p>Make error:</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<pre>cp Oracle.pm blib/lib/DBD/Oracle.pm
cp oraperl.ph blib/lib/oraperl.ph
cp dbdimp.h blib/arch/auto/DBD/Oracle/dbdimp.h
cp ocitrace.h blib/arch/auto/DBD/Oracle/ocitrace.h
cp Oraperl.pm blib/lib/Oraperl.pm
cp Oracle.h blib/arch/auto/DBD/Oracle/Oracle.h
cp lib/DBD/Oracle/GetInfo.pm blib/lib/DBD/Oracle/GetInfo.pm
cp mk.pm blib/arch/auto/DBD/Oracle/mk.pm
/usr/bin/perl.exe -p -e "s/~DRIVER~/Oracle/g" /usr/lib/perl5/site_perl/
5.10/i686
-cygwin/auto/DBI/Driver.xst &gt; Oracle.xsi
/usr/bin/perl.exe /usr/lib/perl5/5.10/ExtUtils/xsubpp  -typemap /usr/
lib/perl5/5
.10/ExtUtils/typemap -typemap typemap  Oracle.xs &gt; Oracle.xsc &amp;&amp; mv
Oracle.xsc O
racle.c
gcc -c  -IC:/oracle/product/10.2.0/client_1/oci/include -IC:/oracle/
product/10.2
.0/client_1/rdbms/demo -I/usr/lib/perl5/site_perl/5.10/i686-cygwin/
auto/DBI -DPE
RL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing -pipe -I/usr/
local/inc
lude -DUSEIMPORTLIB -O3   -DVERSION="1.22" -DXS_VERSION="1.22"  "-
I/usr/lib/
perl5/5.10/i686-cygwin/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -
DNEW_OCI_INIT -
DORA_OCI_VERSION="10.2.0.1" Oracle.c
gcc -c  -IC:/oracle/product/10.2.0/client_1/oci/include -IC:/oracle/
product/10.2
.0/client_1/rdbms/demo -I/usr/lib/perl5/site_perl/5.10/i686-cygwin/
auto/DBI -DPE
RL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -fno-strict-aliasing -pipe -I/usr/
local/inc
lude -DUSEIMPORTLIB -O3   -DVERSION="1.22" -DXS_VERSION="1.22"  "-
I/usr/lib/
perl5/5.10/i686-cygwin/CORE"  -Wall -Wno-comment -DUTF8_SUPPORT -
DNEW_OCI_INIT -
DORA_OCI_VERSION="10.2.0.1" dbdimp.c
dbdimp.c: In function `ora_db_login6':
dbdimp.c:450: warning: cast to pointer from integer of different size

{ A bunch more cast and int format warnings from oci8.c}

rm -f blib/arch/auto/DBD/Oracle/Oracle.dll
LD_RUN_PATH="C:/oracle/product/10.2.0/client_1/lib:C:/oracle/product/
10.2.0/clie
nt_1/rdbms/lib" g++  --shared  -Wl,--enable-auto-import -Wl,--export-
all-symbols
 -Wl,--stack,8388608 -Wl,--enable-auto-image-base -L/usr/local/lib
Oracle.o dbdi
mp.o oci8.o  -o blib/arch/auto/DBD/Oracle/Oracle.dll
          /usr/lib/perl5/5.10/i686-cygwin/CORE/libperl.dll.a -L/
cygdrive/c/cpan/
5.10.0/build/DBD-Oracle-1.22 -loci      

Oracle.o:Oracle.c:(.text+0x6ba9): undefined reference to
`_OCILobGetChunkSize'
dbdimp.o:dbdimp.c:(.text+0x10e3): undefined reference to
`_OCINlsCharSetIdToName
'
dbdimp.o:dbdimp.c:(.text+0x110f): undefined reference to
`_OCINlsCharSetIdToName
'
collect2: ld returned 1 exit status
make: *** [blib/arch/auto/DBD/Oracle/Oracle.dll] Error 1</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>[ad#middle_end]</p>
<p><strong>!!! HERE IS THE SOLUTION !!!</strong></p>
<p><strong>Taken from http://cpae.typepad.com/capacity_planning_and_eng/ </strong></p>
<p><strong>Thanks to Erik Squires!</strong></p>
<p>[Quote]</p>
<p><span style="font-size: 17px; font-family: Trebuchet MS;"><span id=":i7" class="VrHWId">undefined reference to `_OCILobGetChunkSize&#8217; </span></span></p>
<p>Several people helped me with a fix, but this text below is thanks to Jerry Reed.  Thanks Jerry!</p>
<p>Please note this problem ONLY occurs under Windows.  If you are running Perl under Unix/Linux/MacOS you should be fine.</p>
<p>Jerry Wrote:</p>
<p>The make of DBD Oracle builds an intermediate lib, liboci.a.  Functions defined in this lib are somehow culled from the appropriate cygwin distro dll by the line that reads:</p>
<p>system(&#8220;dlltool &#8211;input-def oci.def &#8211;output-lib liboci.a&#8221;) at line 235 in Makefile.PL.</p>
<p>But oci.def lacks entries for the two undefined symbols -<br />
_OCILobGetChunkSize</p>
<p>and</p>
<p>_OCINlsCharSetIdToName</p>
<p>(the later is named twice in the linker output).</p>
<p>Strip the leading underscore and insert them into a copy of oci.def. (I inserted them in alpha order, but I do not know if this is really required.)</p>
<p>rm, or use make clean to remove liboci.a and cause it to be rebuilt.</p>
<p>perl Makefile.PL<br />
make</p>
<p>You should get no unresolved symbols now.  You can check that liboci.a now contains the correct entries by:</p>
<p>nm liboci.a | egrep -i &#8216;(chunk|nls)&#8217;</p>
<p>[/Quote]</p>
<p>[ad#middle_end] </p>
]]></content:encoded>
			<wfw:commentRss>http://usestrict.net/2009/01/dbdoracle-cygwin-error-during-make/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

