3063 Posts in 864 Topics by 646 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1678 Views |
-
External Database

12 November 2009 at 2:13am Last edited: 12 November 2009 2:15am
Continuing this old thread :
http://silverstripe.org/archive/show/120The thread is about connecting to external MySQL MySQL databases. And the guys figures out that in order for this to work, the core MySQLDatabase class needs to be altered to create a new MYSQL Link every time ....
Sam ends with :
"Setting the new_link parameter seems appropriate; the alternative would be to call "USE xxx" before each database query which would get annoying, especially given that multi-database access is a pretty rare scenario."My questions:
Is this still the "official" way of pulling data from an external database ? Should I expect any adverse results from creating a new DB_link every time (garbage collection / mem usage / performance issues etc.)Thanks !
-
Re: External Database

2 December 2009 at 9:42pm
Wow, thats a seriously old thread ;) You can have named connections via DB::getConn(<my-name>) now
-
Re: External Database

21 January 2010 at 7:56am Last edited: 21 January 2010 7:57am
This is the code for DB::getConn()...
/**
* Get the global database connection.
* @return Database
*/
static function getConn() {
return DB::$globalConn;
}It doesn't look like it supports named connections unless I'm missing something. Can you post an example?
Thanks.
-
Re: External Database

21 January 2010 at 8:28am
Thanks for the quick response.
Just one more thing to look forward to in 2.4
| 1678 Views | ||
|
Page:
1
|
Go to Top |



