<?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>threehv &#187; Smalltalk</title>
	<atom:link href="http://www.3hv.co.uk/blog/tag/smalltalk/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.3hv.co.uk/blog</link>
	<description>precision engineering for your website</description>
	<lastBuildDate>Fri, 13 Jan 2012 16:18:18 +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>Loading the MySQL drivers into GNU Smalltalk</title>
		<link>http://www.3hv.co.uk/blog/2008/11/14/loading-the-mysql-drivers-into-gnu-smalltalk/</link>
		<comments>http://www.3hv.co.uk/blog/2008/11/14/loading-the-mysql-drivers-into-gnu-smalltalk/#comments</comments>
		<pubDate>Fri, 14 Nov 2008 12:50:04 +0000</pubDate>
		<dc:creator>Rahoul Baruah</dc:creator>
				<category><![CDATA[Beautiful Code]]></category>
		<category><![CDATA[Smalltalk]]></category>
		<category><![CDATA[gnu]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.3hv.co.uk/blog/?p=310</guid>
		<description><![CDATA[It&#8217;s an unfortunate fact that many Open Source projects have documentation that is sadly lacking. A case in point is GNU Smalltalk. Smalltalk is one of my favourite languages but a decent Smalltalk implementation that fits with your native window manager is hard to find. The point of GNU Smalltalk is that it works &#8220;headlessly&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s an unfortunate fact that many Open Source projects have documentation that is sadly lacking.  A case in point is GNU Smalltalk.  </p>
<p>Smalltalk is one of my favourite languages but a decent Smalltalk implementation that fits with your native window manager is hard to find.  The point of GNU Smalltalk is that it works &#8220;headlessly&#8221; (Smalltalk invented the graphical user-interface and the integrated development environment so this is quite a departure), so I can still use my favourite text editor and run stuff from the command line.  Just like Ruby!</p>
<p>However, it&#8217;s taken me a couple of hours to figure out how to simply connect to a database.  But now I have, here it is: </p>
<ul>
<li>Install GNU Smalltalk (in my case using MacPorts):<br />
    <code>sudo port install gst</code>
  </li>
<li>Start GNU Smalltalk and create a working image:<br />
<code>cd /Users/rahoulb/source/st<br />
gst<br />
st> ObjectMemory snapshot: 'work.im'.</code>
</li>
<li>Ctrl-D to exit Smalltalk and then restart using your new image:<br />
<code>gst -I work.im</code>
</li>
<li>Load the DBI database driver:<br />
<code>st> PackageLoader fileInPackage: 'DBI'.</code><br />
Load the MySQL driver:<br />
<code>st> PackageLoader fileInPackage: 'DBD-MySQL'.</code><br />
Save your image so you don&#8217;t need to reload these packages again:<br />
<code>st> ObjectMemory snapshot.</code>
</li>
<li>
Open a connection to your database:<br />
<code>st>con:= DBI.Connection connect: 'dbi:MySQL:dbname=mydatabase' user: 'myuser' password: 'mypassword'.</code><br />
Grab some data:<br />
<code>st>results:= con select: 'select name from customers limit 10;'</code>
</li>
<li>Bask in the glory of your data</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.3hv.co.uk/blog/2008/11/14/loading-the-mysql-drivers-into-gnu-smalltalk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.186 seconds -->

