<?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>tov's Blog &#187; informix</title>
	<atom:link href="http://blog.nobody-is-like.me/tag/informix/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.nobody-is-like.me</link>
	<description>Just another (geeky) WordPress weblog</description>
	<lastBuildDate>Tue, 16 Mar 2010 13:43:04 +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>Establish a 2nd database connection in Rails</title>
		<link>http://blog.nobody-is-like.me/2009/06/establish-a-2nd-database-connection-in-rails/</link>
		<comments>http://blog.nobody-is-like.me/2009/06/establish-a-2nd-database-connection-in-rails/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 15:54:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Ruby and Rails]]></category>
		<category><![CDATA[informix]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.nobody-is-like.me/2009/06/18/establish-a-2nd-database-connection-in-rails/</guid>
		<description><![CDATA[OK, you can find some howto&#8217;s everywhere on the web but only on this site I found the complete solution: class SecondConnection &#60; ActiveRecord::Base SecondConnection.establish_connection( :adapter =&#62; &#34;informix&#34;, :host =&#62; &#34;localhost&#34;, :username =&#62; &#34;hansnase&#34;, :password =&#62; &#34;very_secret&#34;, :database =&#62; &#34;ccdb@localhost&#34; ) self.abstract_class = true end &#8220;self.abstract_class = true&#8221; makes the thing actually work. Otherwise Rails [...]]]></description>
			<content:encoded><![CDATA[<p>OK, you can find some howto&#8217;s everywhere on the web but only on <a href="http://blog.freerails.de/?p=347">this</a> site I found the complete solution:</p>
<pre class="brush: ruby;">
class SecondConnection &lt; ActiveRecord::Base

SecondConnection.establish_connection(
:adapter  =&gt; &quot;informix&quot;,
:host     =&gt; &quot;localhost&quot;,
:username =&gt; &quot;hansnase&quot;,
:password =&gt; &quot;very_secret&quot;,
:database =&gt; &quot;ccdb@localhost&quot;
)

self.abstract_class = true
end
</pre>
<p>&#8220;self.abstract_class = true&#8221; makes the thing actually work. Otherwise Rails seems to cache the database connection and does not switch back if you access any other classes but SecondConnection.</p>
<p>Yeah!</p>
<p>Later: Not so Yeah&#8230;</p>
<p>I had to establish another call to</p>
<pre class="brush: ruby;">
  ActiveRecord::Base.establish_connection
       logger.info { &quot;Establishing Base Connection&quot; }
       log_connections
</pre>
<p>I assume it&#8217;s either an Informix problem or related to the old rails version I&#8217;m driving with.<br />
Nevertheless: It works now.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.nobody-is-like.me/2009/06/establish-a-2nd-database-connection-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
