<?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>Mission Data Blog &#187; Database</title>
	<atom:link href="http://www.missiondata.com/blog/category/database/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.missiondata.com/blog</link>
	<description>Louisville-based Web Development &#38; Software Engineering</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:58:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>DNA is Good</title>
		<link>http://www.missiondata.com/blog/software-development/404/dna-is-good/</link>
		<comments>http://www.missiondata.com/blog/software-development/404/dna-is-good/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 20:48:10 +0000</pubDate>
		<dc:creator>joev</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Site Launch]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[genetic database]]></category>
		<category><![CDATA[genetic research]]></category>
		<category><![CDATA[Intrepid Bioinformatics]]></category>
		<category><![CDATA[SaaS]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/?p=404</guid>
		<description><![CDATA[Ok, bad paraphrasing aside, for one moment, put on your best “Gordon Gekko” suit, and loosely consider this: is it possible to create an investment portfolio with genetic data?]]></description>
			<content:encoded><![CDATA[<div id="attachment_405" class="wp-caption alignnone" style="width: 510px"><a href="http://www.intrepidbio.com"><img class="size-full wp-image-405" title="intrepid-blog" src="http://www.missiondata.com/blog/wp-content/uploads/2011/01/intrepid-blog.jpg" alt="Screen capture of the Intrepid Bioinformatics website." width="500" height="368" /></a><p class="wp-caption-text">Screen capture of the Intrepid Bioinformatics website.</p></div>
<p>Ok, bad paraphrasing aside, for one moment, put on your best “Gordon Gekko” suit, and loosely consider this:</p>
<p>In finance, a portfolio is a collection of investments held by an institution or an individual. Holding a portfolio is a part of an investment and risk-limiting strategy called diversification &#8211; by owning several assets, or “things with value”, certain types of risk can be reduced. In building up an investment portfolio, a financial institution will typically conduct investment analysis, while a private individual may make use of a financial advisor/institution&#8217;s portfolio management services.</p>
<p>Now ask yourself this &#8211; what if there were a way to do this with, oh I don&#8217;t know: your genetic data? Enter <a title="Intrepid Bioinformatics" href="http://www.intrepidbio.com" target="_blank">Intrepid Bioinformatics</a>.</p>
<p>Intrepid&#8217;s founders had a vision, one of a heterogenous genetic data management platform that would allow researchers to store, compare, and contextualize genetic trends, as well as purchase reagents and consumables, all in one place. With a newly-designed identity by <a title="Katie Bush Design, Inc." href="http://www.katiebushdesign.com/" target="_blank">Katie Bush Design, Inc.</a> in hand, Intrepid and their team came to Mission Data looking to take this concept out of the futuristic conversational realm and bring it into the “now”.</p>
<h3>What Does It Do?</h3>
<p>A “software-as-a-service” platform allows genetic researchers to compare similar data sets from thousands of samples side-by-side. With Intrepid, a researcher can begin to quickly identify trends in entire populations which will have the potential to quickly advance discoveries in the medical, pharmaceutical and agricultural biotechnology industries. From free trials to rich-access subscriber plans, users are presented with an impressive load of features right out of the gate &#8211; multiple upload options, data downloading, user tutorials, and active collaboration between other community members of your choice, to name a few.</p>
<h3>Who&#8217;s Using It?</h3>
<p>Intrepid appeals to the genetic research community in two sectors: human genome research and animal (specifically, bovine) research. The markets for these two segments are vastly different, and the audience can be further segmented into researchers working for larger companies/governments/universities vs. researchers in small, relatively unfunded labs.</p>
<p>Take, for example, a cattle farmer. He or she obviously has a vested interest in ensuring that their clients are receiving the best product possible, be it milk, beef, etc. By using Intrepid&#8217;s services, they can access a wealth of genetic data that will help them determine which lines of cattle are best suited for those assorted purposes. And, which lines they might want to avoid because of a predilection for disease.</p>
<p>That&#8217;s not to say those are the only audience contingents that Intrepid is looking to pull into their community. On the contrary, a day on the horizon can be seen in which members of the public can look to utilize Intrepid Bioinformatics&#8217; services like a digital genetic bank, safely and securely storing their data with constant and “at-will” access.</p>
<p>Our team at Mission Data constantly look to push and redefine the boundaries of what is thought possible and conventional in the realm of the web. And, I think I can speak for all of us when I say that if we can <em><strong>eliminate</strong></em> boundaries and make the ideas of the future happen while partnering with great clients, then the ride is made all the better. This was certainly the case here.</p>
<p>To further paraphrase Gordon Gekko: “It&#8217;s all about the &#8216;now&#8217;, kid. The rest is just conversation.”</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/software-development/404/dna-is-good/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Epicurean Tips on the Go</title>
		<link>http://www.missiondata.com/blog/design/341/epicurian-tips-on-the-go/</link>
		<comments>http://www.missiondata.com/blog/design/341/epicurian-tips-on-the-go/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 17:35:37 +0000</pubDate>
		<dc:creator>Cindi</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Mobile Application]]></category>
		<category><![CDATA[food tech]]></category>
		<category><![CDATA[iPhone App]]></category>
		<category><![CDATA[Mission Data client]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[Tasting Table app]]></category>
		<category><![CDATA[ui]]></category>
		<category><![CDATA[ux]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/?p=341</guid>
		<description><![CDATA[Wondering where to go when you’re hungry? Tasting Table offers foodies a delicious daily digest of taste-tested recipes from world-renowned chefs and ideas about dining, wine, cocktails, cooking and more. Local editions for New York, Los Angeles, Chicago, San Francisco and Washington D.C, delight more than 300,000 registered users with highlights of neighborhood buzz, must-visit hot [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://itunes.apple.com/us/app/tasting-table-to-go/id413109890"><img class="aligncenter size-full wp-image-340" title="tt-blog" src="http://www.missiondata.com/blog/wp-content/uploads/2010/12/tt-blog.jpg" alt="tt-blog" width="500" height="368" /></a></p>
<p>Wondering where to go when you’re hungry? <a title="Tasting Table National" href="http://www.tastingtable.com/index.htm" target="_blank">Tasting Table</a> offers foodies a delicious daily digest of taste-tested recipes from world-renowned chefs and ideas about dining, wine, cocktails, cooking and more.</p>
<p>Local editions for New York, Los Angeles, Chicago, San Francisco and Washington D.C, delight more than <a title="Tech Crunch Daily Candy for Foodies" href="http://techcrunch.com/2010/07/04/tasting-table-is-the-daily-candy-for-foodies/" target="_blank">300,000 registered users</a> with highlights of neighborhood buzz, must-visit hot spots, dishes to try and high-profile personalities. The national edition serves up exclusive recipes from Tasting Table’s chefs with a bonus sneak preview of America’s hottest new eateries.</p>
<p>Working with the Tasting Table team, Mission Data designed and developed the iPhone application including integrating with Tasting Table&#8217;s web services on their existing web-based application taking the existing website content mobile.</p>
<p>Download the application from the <a title="iTunes App Store" href="http://itunes.apple.com/us/app/tasting-table-to-go/id413109890" target="_blank">iTunes App Store</a> to find nearby recommendations, create and manage your To-Do lists and consume articles and recommendations from the Tasting Table website easily on your iPhone or iPod touch.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/design/341/epicurian-tips-on-the-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sending UTF-8 email with Oracle</title>
		<link>http://www.missiondata.com/blog/database/79/sending-utf-8-email-with-oracle/</link>
		<comments>http://www.missiondata.com/blog/database/79/sending-utf-8-email-with-oracle/#comments</comments>
		<pubDate>Wed, 18 Apr 2007 19:45:02 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/uncategorized/79/sending-utf-8-email-with-oracle/</guid>
		<description><![CDATA[I have seen several examples of sending email using oracle with non-ascii characters floating around the Internet, but few seem to tackle sending these &#8216;special&#8217; characters in both the subject and the body. Many also take a shortcut and use 8bit transfer encoding for the body. I am 99.9% sure that this will work on [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen several examples of sending email using oracle with non-ascii characters floating around the Internet, but few seem to tackle sending these &#8216;special&#8217; characters in both the subject and the body.  Many also take a shortcut and use 8bit <a href="http://en.wikipedia.org/wiki/MIME#Content-Transfer-Encoding">transfer encoding</a> for the body.  I am 99.9% sure that this will work on today&#8217;s mail servers, but basic SMTP only really needs to support 3 transfer encodings &#8211; 7bit ascii, base64, and quoted-printable.</p>
<p><span id="more-79"></span></p>
<p>For my example I chose the latter.  Quoted-printable has two distinct advantages: 1) It should be supported by all servers and 2) Unlike base64 it will keep characters that are 7bit ascii in ascii and only encode characters it needs to.</p>
<pre><code>CREATE OR REPLACE PROCEDURE MAIL_TEST IS
  lv_server      VARCHAR2(255) := '';
  lv_rcpt        VARCHAR2(255) := 'to@example.com';
  lv_from        VARCHAR2(255) := 'from@example.com';
  lv_subject     VARCHAR2(255) := 'Le chien paresseux a sauté';
  lv_message     VARCHAR2(255) := 'Voix ambiguë d''un coeur qui au zéphyr préfère les jattes de kiwis';
  lv_conn        UTL_SMTP.CONNECTION;
BEGIN
  lv_Conn := UTL_SMTP.Open_Connection(lv_server);
  UTL_SMTP.Helo(lv_conn, lv_server);
  UTL_SMTP.Mail(lv_conn, lv_from);
  UTL_SMTP.Rcpt(lv_conn, lv_rcpt);
  UTL_SMTP.OPEN_DATA(lv_conn);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Subject: =?UTF-8?Q?' ||
                                UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.QUOTED_PRINTABLE_ENCODE(UTL_RAW.CAST_TO_RAW(lv_subject))) ||
                                '?=' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'MIME-version: 1.0' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Content-Type: text/html;charset=utf-8' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Content-Transfer-Encoding: quoted-printable '|| UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'Date: ' || TO_CHAR(SYSDATE, 'dd Mon yy hh24:mi:ss' ) ||' -0800 (GMT)' || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'From: ' || lv_from || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn, 'To: ' || lv_rcpt || UTL_TCP.CRLF);
  UTL_SMTP.WRITE_DATA(lv_conn,  UTL_TCP.CRLF);
  UTL_SMTP.WRITE_RAW_DATA(lv_conn, UTL_ENCODE.QUOTED_PRINTABLE_ENCODE(UTL_RAW.CAST_TO_RAW(lv_message)));
  UTL_SMTP.WRITE_DATA(lv_conn, UTL_TCP.CRLF);
  UTL_SMTP.CLOSE_DATA(lv_conn);
  UTL_SMTP.QUIT(lv_conn);
END;</code></pre>
<p>If you wanted to use 8bit ascii you would change the data and transfer encoding header to this:</p>
<pre><code>UTL_SMTP.WRITE_DATA(lv_conn, 'Content-Transfer-Encoding: 8bit'|| UTL_TCP.CRLF);
UTL_SMTP.WRITE_RAW_DATA(lv_conn, UTL_RAW.CAST_TO_RAW(UTL_TCP.CRLF || lv_message || UTL_TCP.CRLF));</code></pre>
<p>Finally, you can also use base64 encoding for the subject:</p>
<pre><code>  UTL_SMTP.WRITE_DATA(lv_conn, 'Subject: =?UTF-8?B?' ||
                                UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(UTL_RAW.CAST_TO_RAW(lv_subject))) ||
                                '?=' || UTL_TCP.CRLF);</code></pre>
<p>Calling me a PL/SQL developer would be an insult to PL/SQL developers everywhere.  I apologize in advance for any perceived lack of style.  Most of the variables would be sourced from parameters passed in to the procedure or database values.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/database/79/sending-utf-8-email-with-oracle/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Computing time with Oracle sysdate</title>
		<link>http://www.missiondata.com/blog/database/77/computing-time-with-oracle-sysdate/</link>
		<comments>http://www.missiondata.com/blog/database/77/computing-time-with-oracle-sysdate/#comments</comments>
		<pubDate>Wed, 11 Apr 2007 15:35:39 +0000</pubDate>
		<dc:creator>carsonm</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[sysdate]]></category>

		<guid isPermaLink="false">http://www.missiondata.com/blog/oracle/77/computing-time-with-oracle-sysdate/</guid>
		<description><![CDATA[If you ever need to work with something other than a day when using sysdate you are in luck. As it turns out you can work on sysdate with fractional days. This is just what a person needs when they want to do something like: SELECT mycol FROM sometable WHERE sometimestamp &#38;lt; "30 seconds ago" [...]]]></description>
			<content:encoded><![CDATA[<p>If you ever need to work with something other than a day when using sysdate you are in luck. As it turns out you can work on sysdate with fractional days. This is just what a person needs when they want to do something like:</p>
<pre><code>SELECT mycol FROM sometable WHERE sometimestamp &amp;lt; "30 seconds ago"</code></pre>
<p>The main trick here is to know that sysdate math is based in days and fractional days work. Here are a few examples:</p>
<p><strong>Remove hours from a date</strong>:</p>
<p>sysdate &#8211; hours/hours in a day</p>
<p><strong>Remove minutes from a date</strong>:</p>
<p>sysdate &#8211; minutes/(hours in a day * minutes in an hour)<br />
or<br />
sysdate &#8211; minutes/minutes in a day</p>
<p><strong>Remove seconds from a date</strong>:</p>
<p>sysdate &#8211; seconds/(hours in a day * minutes in an hour * seconds in a minute)<br />
or<br />
sysdate &#8211; seconds/seconds in a day</p>
<p>The example above would be:</p>
<pre><code>SELECT mycol FROM sometable WHERE sometimestamp &amp;lt; sysdate - 30/(24*60*60)</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/database/77/computing-time-with-oracle-sysdate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing oracle with sqlplus and no tnsnames</title>
		<link>http://www.missiondata.com/blog/database/59/accessing-oracle-with-sqlplus-and-no-tnsnames/</link>
		<comments>http://www.missiondata.com/blog/database/59/accessing-oracle-with-sqlplus-and-no-tnsnames/#comments</comments>
		<pubDate>Fri, 28 Jul 2006 19:07:12 +0000</pubDate>
		<dc:creator>steveny</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=59</guid>
		<description><![CDATA[If you want to access a database without it being in your tnsnames.ora file, you can use a &#8216;URL&#8217; at the command line: sqlplus login/pwd@//hostname:1521/sidname This should work with versions 9 and above. Let me know if other versions work.]]></description>
			<content:encoded><![CDATA[<p>If you want to access a database without it being in your tnsnames.ora file, you can use a &#8216;URL&#8217; at the command line:</p>
<p><code> sqlplus login/pwd@//hostname:1521/sidname</code></p>
<p>This should work with versions 9 and above.  Let me know if other versions work.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/database/59/accessing-oracle-with-sqlplus-and-no-tnsnames/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Converting unix or java timestamps (time since the epoch) to real dates with Oracle</title>
		<link>http://www.missiondata.com/blog/database/47/converting-unix-or-java-timestamps-time-since-the-epoch-to-real-dates-with-oracle/</link>
		<comments>http://www.missiondata.com/blog/database/47/converting-unix-or-java-timestamps-time-since-the-epoch-to-real-dates-with-oracle/#comments</comments>
		<pubDate>Sat, 29 Apr 2006 17:12:17 +0000</pubDate>
		<dc:creator>carsonm</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=47</guid>
		<description><![CDATA[A few days ago I made use of a couple Oracle built in functions and it made me happy I didn&#8217;t have to write a stored proc or some type of mini-app to do it. I needed to parse a timestamp out of a field that was put there by a java program. The timestamp [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I made use of a couple Oracle built in functions and it made me happy I didn&#8217;t have to write a stored proc or some type of mini-app to do it. I needed to parse a timestamp out of a field that was put there by a java program. The timestamp was just the output of System.currentTimeInMillis()  and was concatenated onto some other information. </p>
<p>It took a little digging to find out how to convert a <a href="http://en.wikipedia.org/wiki/Unix_time">epoch</a> style timestamp but here it is:</p>
<pre>
<code>select new_time( to_date('01011970', 'ddmmyyyy') + 1/24/60/60 * :currenttimeinmillis/1000, 'GMT', 'EDT' ) from dual</code>
</pre>
<p>Note that I convert the output from GMT to EDT here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/database/47/converting-unix-or-java-timestamps-time-since-the-epoch-to-real-dates-with-oracle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby Oracle DBI ActiveRecord in 7 steps</title>
		<link>http://www.missiondata.com/blog/database/26/ruby-oracle-dbi-activerecord-in-7-steps/</link>
		<comments>http://www.missiondata.com/blog/database/26/ruby-oracle-dbi-activerecord-in-7-steps/#comments</comments>
		<pubDate>Thu, 23 Mar 2006 00:35:26 +0000</pubDate>
		<dc:creator>carsonm</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=26</guid>
		<description><![CDATA[Setting up ruby to work with Oracle seems to be a pain for a lot of people. Here are the steps I follow to set it up on a linux box from nothing to Active Record or DBI in 7 steps. Gather the installation sources you will need. You have to be registered with oracle [...]]]></description>
			<content:encoded><![CDATA[<p>
Setting up ruby to work with Oracle seems to be a pain for a lot of people. Here are the steps I follow to set it up on a linux box from nothing to Active Record or DBI in 7 steps.
</p>
<ol>
<li>
   Gather the installation sources you will need. You have to be registered with oracle to get their instant client packages.<br />
   Download the <a href="http://www.jiubao.org/ruby-oci8/">ruby oci8 drivers</a><br />
   Download the <a href="http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html">oracle instant client</a><br />
   You want the following packages (these examples assume the zip format):</p>
<ul>
<li>Instant Client Package &#8211; Basic or Instant Client Package &#8211; Basic Lite</li>
<li>Instant Client Package &#8211; SDK</li>
<li>Instant Client Package &#8211; SQL*Plus (optional but nice to have)</li>
</ul>
</li>
<p><span id="more-26"></span></p>
<li>Install oracle instant client packages <br/><br />
     I unzip them in the /opt directory and assume that for the examples. It doesn&#8217;t matter where you put them as long as you know where they are.<br/><br />
     The zip packages have one problem that needs to be solved after they are expanded. You must create a symlink in the install directory for a shared library: ln -s libclntsh.so.10.1 libclntsh.so<br/></p>
</li>
<li>Set up the oracle environment: <br/>
<p>     I created a script called oracleenv.sh with the following lines in it:</p>
<pre>
<code>     export ORACLE_HOME=/opt/instantclient_10_2/
     export LD_LIBRARY_PATH=/opt/instantclient_10_2/
     export PATH=/opt/instantclient_10_2/:$PATH
     export SQLPATH=/opt/instantclient_10_2/
     export TNS_ADMIN=/etc/</code>
</pre>
<p>     and then I source it when I want to use something oracle related &#8220;. oracleenv.sh&#8221;. You may want to just put it in your profile. <br/></p>
<p>     You also need to create a /etc/tnsnames.ora file. This can be tricky. The best option is probably to ask your DBA to create it for you. Here is an example:<br/></p>
<pre>
<code>DEVDB.WORLD =
  (DESCRIPTION =
    (ADDRESS_LIST =
        (ADDRESS =
          (COMMUNITY = tcp.world )
          (PROTOCOL = TCP)
          (Host = 192.168.1.125)
          (Port = 1546)
        )
    )
    (CONNECT_DATA = (SID = DEVDB)
    )
  )</code>
</pre>
<p>  The main thing you need for ruby later is the SID. At this point you may want to try to use sqlplus to see if you can connect to the database.
  </li>
<li>Build the ruby oci8 package<br/><br />
   untar</p>
<pre><code>ruby setup.rb config -- --with-instant-client=/opt/instantclient_10_2/</code></pre>
<p>   make<br />
   make install
  </li>
<li>Give the low level API a test <br/>
<pre><code>ruby -r oci8 -e "OCI8.new('username', 'password', 'DEVDB.WORLD').exec('select sysdate from dual') do |r| puts r.join(','); end"</code></pre>
<p>  Here you provide the username, password and tns name. If this returns the current date and time then the driver is installed correctly.
  </li>
<li>Install DBI<br/><br />
   download the <a href="http://rubyforge.org/projects/ruby-dbi/">dbi tar file</a><br />
   The current version is: dbi-0.1.0.tar.gz<br />
   untar the archive<br />
   configure it (for this example only dbi itself is included): ruby setup.rb config &#8211;with=dbi<br />
   build: ruby setup.rb setup<br />
   install: ruby setup.rb install<br />
   test: </p>
<pre>
<code>require 'dbi'
dbh = DBI.connect('DBI:OCI8:DEVDB.WORLD', 'username', 'password')
dbh.select_all('select sysdate from dual') do | row |
  p row
end
dbh.disconnect</code>
</pre>
<p>   If this returns the current date and time then DBI is installed correctly.
  </li>
<li> Install ActiveRecord<br/><br />
  I use gem to install active record: gem install activerecord <br/><br />
  After installing you should be able to use active record. Here is an example use: <br/></p>
<pre>
<code>require 'rubygems'
require 'active_record'

ActiveRecord::Base.establish_connection(
    :adapter =&gt; "oci",
    :username =&gt; "username",
    :password =&gt; "password",
    :host =&gt; "DEVDB.WORLD")

class TestTable &lt; ActiveRecord::Base
  set_table_name "test_table"
  set_primary_key "some_id"
end

TestTable.find(:all).each do |tt|
  p tt
end

nac = TestTable.new()
nac.id = 1001
nac.some_column = "test"
nac.save()
</code>
</pre>
<p>  One thing I learned that is someone confusing is that active record turns your primary key into a variable named &#8220;id&#8221;. So if you don&#8217;t use auto generated primary keys for some reason you can&#8217;t just assign the primary key based on the name of the column as you can any other column in the table. Instead you need to use the id field of the model.</p>
</li>
</ol>
<p>
For more information check out the following links:</p>
<ul>
<li>Info on <a href="http://www.oracle.com/technology/docs/tech/sql_plus/10103/readme_ic.htm">oracle&#8217;s instant client</a></li>
<li>Info on <a href="http://www.kitebird.com/articles/ruby-dbi.html">using dbi</a></li>
<li>Info on <a href="http://ruby-dbi.rubyforge.org/">dbi</a> </li>
<li>Info on <a href="http://wiki.rubyonrails.org/rails/pages/Oracle">rails with oracle</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/database/26/ruby-oracle-dbi-activerecord-in-7-steps/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Fun with Oracle Strings</title>
		<link>http://www.missiondata.com/blog/database/10/fun-with-oracle-strings/</link>
		<comments>http://www.missiondata.com/blog/database/10/fun-with-oracle-strings/#comments</comments>
		<pubDate>Tue, 14 Feb 2006 03:14:07 +0000</pubDate>
		<dc:creator>carsonm</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[Oracle]]></category>

		<guid isPermaLink="false">http://blogs.missiondata.com/?p=10</guid>
		<description><![CDATA[Today I needed to find a way to count the number of unique email domains in a table. I figured there was a way of getting the index of a string in another string and sure enough there is. This did the trick in Oracle: select count(1), SUBSTR(email, INSTR(email, '@', 1, 1)+1) from SOMETABLE group [...]]]></description>
			<content:encoded><![CDATA[<p>Today I needed to find a way to count the number of unique email domains in a table. I figured there was a way of getting the index of a string in another string and sure enough there is. This did the trick in Oracle:</p>
<pre><code>select count(1), SUBSTR(email, INSTR(email, '@', 1, 1)+1) from SOMETABLE group by SUBSTR(email, INSTR(email, '@', 1, 1)+1) order by count(1) desc</code></pre>
<p>The INSTR function gives you the location in a string where another string is located. See the following link for more on the INSTR function: <a href="http://www.techonthenet.com/oracle/functions/instr.php">http://www.techonthenet.com/oracle/functions/instr.php</a></p>
<p>I&#8217;ve always found the way Oracle handles case interesting. It looks like they are changing things a little starting with 10G: <a href="http://blogs.ittoolbox.com/database/solutions/archives/005951.asp">http://blogs.ittoolbox.com/database/solutions/archives/005951.asp</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.missiondata.com/blog/database/10/fun-with-oracle-strings/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

