<?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: Automatically choose database connections in CakePHP</title>
	<atom:link href="http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp</link>
	<description>get all his digital goodness 24/7</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:05:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: Eddie</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-2782</link>
		<dc:creator>Eddie</dc:creator>
		<pubDate>Sun, 30 Jan 2011 14:10:54 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-2782</guid>
		<description>@sehrry
It can be done.but not in the bootstrap file which is one time startup.you will have to hook into your login workflow and make the change through App: config.
App controller might be a decent place since all requests can access it.
Good luck</description>
		<content:encoded><![CDATA[<p>@sehrry<br />
It can be done.but not in the bootstrap file which is one time startup.you will have to hook into your login workflow and make the change through App: config.<br />
App controller might be a decent place since all requests can access it.<br />
Good luck</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sehrry</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-2781</link>
		<dc:creator>Sehrry</dc:creator>
		<pubDate>Sun, 30 Jan 2011 00:29:04 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-2781</guid>
		<description>Hi

I need to let users to change the current database, For example, I have Oracle and MySQL and I want to let user change the db from setting page! Any idea?

Thanks
Sherry</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>I need to let users to change the current database, For example, I have Oracle and MySQL and I want to let user change the db from setting page! Any idea?</p>
<p>Thanks<br />
Sherry</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ralph</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-1655</link>
		<dc:creator>Ralph</dc:creator>
		<pubDate>Fri, 30 Jul 2010 07:00:47 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-1655</guid>
		<description>this works for me:

if (stristr($_SERVER[&#039;SERVER_NAME&#039;], &#039;MyServerName&#039;)) {</description>
		<content:encoded><![CDATA[<p>this works for me:</p>
<p>if (stristr($_SERVER['SERVER_NAME'], &#8216;MyServerName&#8217;)) {</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Automatically choose database connections in CakePHP &#124; Edward A &#8230; &#124; Source code bank</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-1339</link>
		<dc:creator>Automatically choose database connections in CakePHP &#124; Edward A &#8230; &#124; Source code bank</dc:creator>
		<pubDate>Sat, 10 Apr 2010 10:10:12 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-1339</guid>
		<description>[...] the original post here: Automatically choose database connections in CakePHP &#124; Edward A &#8230;   If you enjoyed this article please consider sharing [...]</description>
		<content:encoded><![CDATA[<p>[...] the original post here: Automatically choose database connections in CakePHP | Edward A &#8230;   If you enjoyed this article please consider sharing [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eddie</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-1318</link>
		<dc:creator>Eddie</dc:creator>
		<pubDate>Thu, 18 Mar 2010 14:08:26 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-1318</guid>
		<description>@gattu
The point here is to get away from manually set variables. IMHO code should not change between environments </description>
		<content:encoded><![CDATA[<p>@gattu<br />
The point here is to get away from manually set variables. IMHO code should not change between environments</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gattu marrudu</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-1311</link>
		<dc:creator>gattu marrudu</dc:creator>
		<pubDate>Sun, 14 Mar 2010 10:35:15 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-1311</guid>
		<description>Iuse a similar method, but set a constant APP_ENV in the main index.php file - easier to find, and to switch options automatically (debug level, security etc.) in other files. 

	function __construct() {
		switch(APP_ENV) {
			case &#039;production&#039;: 
				$this-&gt;default = $this-&gt;production;
			case &#039;staging&#039;: 
				$this-&gt;default = $this-&gt;staging;
			default: 
				$this-&gt;default = $this-&gt;devel;
		}
	}</description>
		<content:encoded><![CDATA[<p>Iuse a similar method, but set a constant APP_ENV in the main index.php file &#8211; easier to find, and to switch options automatically (debug level, security etc.) in other files. </p>
<p>	function __construct() {<br />
		switch(APP_ENV) {<br />
			case &#8216;production&#8217;:<br />
				$this-&gt;default = $this-&gt;production;<br />
			case &#8216;staging&#8217;:<br />
				$this-&gt;default = $this-&gt;staging;<br />
			default:<br />
				$this-&gt;default = $this-&gt;devel;<br />
		}<br />
	}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ZEE4 &#187; Blog Archive &#187; CakePHP database config quick-tip</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-1278</link>
		<dc:creator>ZEE4 &#187; Blog Archive &#187; CakePHP database config quick-tip</dc:creator>
		<pubDate>Sun, 10 Jan 2010 17:06:40 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-1278</guid>
		<description>[...] If you haven&#8217;t, check out Edward A. Webb&#8217;s original post from 1998 [...]</description>
		<content:encoded><![CDATA[<p>[...] If you haven&#8217;t, check out Edward A. Webb&#8217;s original post from 1998 [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sharon</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-577</link>
		<dc:creator>Sharon</dc:creator>
		<pubDate>Tue, 07 Apr 2009 15:14:42 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-577</guid>
		<description>This was very helpful, thanks!  Solved a problem for me!</description>
		<content:encoded><![CDATA[<p>This was very helpful, thanks!  Solved a problem for me!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alex</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-136</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 03 Feb 2009 20:54:05 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-136</guid>
		<description>Small point, how about reducing it further?

function __construct () {
  // Set default DB 
  $this-&gt;default = $_SERVER[&#039;SERVER_NAME&#039;] ==&#039;digbiz.example.com&#039;?$this-&gt;prod:$this-&gt;dev;
}</description>
		<content:encoded><![CDATA[<p>Small point, how about reducing it further?</p>
<p>function __construct () {<br />
  // Set default DB<br />
  $this-&gt;default = $_SERVER['SERVER_NAME'] ==&#8217;digbiz.example.com&#8217;?$this-&gt;prod:$this-&gt;dev;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raphael Spindell</title>
		<link>http://edwardawebb.com/web-development/cakephp/automatically-choose-database-connections-cakephp/comment-page-1/#comment-69</link>
		<dc:creator>Raphael Spindell</dc:creator>
		<pubDate>Mon, 03 Nov 2008 00:31:21 +0000</pubDate>
		<guid isPermaLink="false">http://edwardawebb.com/?p=28#comment-69</guid>
		<description>Why not streamline all this if/else and just use the default: case

//check to see if server name is set (thanks Frank)
		switch($_SERVER[&#039;SERVER_NAME&#039;]){
				case &#039;digbiz.localhost&#039;:
					$this-&gt;default = $this-&gt;dev;
					break;
				case &#039;digbiz.example.com&#039;:
					$this-&gt;default = $this-&gt;prod;
					break;
        default:
    // we are likely baking, use our local db
	        $this-&gt;default = $this-&gt;dev;
}</description>
		<content:encoded><![CDATA[<p>Why not streamline all this if/else and just use the default: case</p>
<p>//check to see if server name is set (thanks Frank)<br />
		switch($_SERVER['SERVER_NAME']){<br />
				case &#8216;digbiz.localhost&#8217;:<br />
					$this-&gt;default = $this-&gt;dev;<br />
					break;<br />
				case &#8216;digbiz.example.com&#8217;:<br />
					$this-&gt;default = $this-&gt;prod;<br />
					break;<br />
        default:<br />
    // we are likely baking, use our local db<br />
	        $this-&gt;default = $this-&gt;dev;<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>

