<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Dynamic Database Connection with CakePHP</title>
	<atom:link href="http://beyondthewheel.com/dynamic-database-connection-with-cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://beyondthewheel.com/dynamic-database-connection-with-cakephp/</link>
	<description>Web Development</description>
	<lastBuildDate>Thu, 13 May 2010 12:35:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Arno Esterhuizen</title>
		<link>http://beyondthewheel.com/dynamic-database-connection-with-cakephp/comment-page-1/#comment-81</link>
		<dc:creator>Arno Esterhuizen</dc:creator>
		<pubDate>Thu, 13 May 2010 12:35:08 +0000</pubDate>
		<guid isPermaLink="false">http://matthewanderton.com/beyondthewheel.com/?p=10#comment-81</guid>
		<description>OK, this might be a bit late, but you can also use the following code in your model

&lt;pre lang=&quot;php&quot;&gt;
$newDb =&amp; ConnectionManager::create(&#039;dynamic_db&#039;, 
array(
    &#039;driver&#039; =&gt;  &#039;mysql&#039;,
    &#039;host&#039; =&gt; &#039;local&#039;,
    &#039;login&#039; =&gt; &#039;user&#039;,
    &#039;password&#039; =&gt; &#039;pass&#039;,
    &#039;database&#039; =&gt; &#039;my_db&#039;));

$this-&gt;useDb = &#039;dynamic_db&#039;;
&lt;/pre&gt;

as per https://dev.cakephp.org/ticket/1068</description>
		<content:encoded><![CDATA[<p>OK, this might be a bit late, but you can also use the following code in your model</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$newDb</span> <span style="color: #339933;">=&amp;</span>amp<span style="color: #339933;">;</span> ConnectionManager<span style="color: #339933;">::</span><span style="color: #004000;">create</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'dynamic_db'</span><span style="color: #339933;">,</span> 
<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'driver'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span>  <span style="color: #0000ff;">'mysql'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'host'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'local'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'login'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'user'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'password'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'pass'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'database'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'my_db'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>useDb <span style="color: #339933;">=</span> <span style="color: #0000ff;">'dynamic_db'</span><span style="color: #339933;">;</span></pre></div></div>

<p>as per <a href="https://dev.cakephp.org/ticket/1068" rel="nofollow">https://dev.cakephp.org/ticket/1068</a></p>
]]></content:encoded>
	</item>
</channel>
</rss>
