Welcome Guest, Not a member yet? Register   Sign In
Multiple databases connection problem
#1

[eluser]jahbob[/eluser]
Hi I will try to describe my problem here:

I was running a script locally that handled 3 connections to mysql running at same time with 3 different hosts


Now Im running same script but on one of hosts so I still have 3 connections but 2 of them are from same host, but they are from different databases on same host

The problem is that one of the connections dosnt select the right database, it just selects the last database used for that host .

My configs are :

$config['hostname'] = "host1";
$config['username'] = "x";
$config['password'] = "x";
$config['database'] = "database";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = TRUE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";

$this->conn1= $this->load->database($config,TRUE);



$config2['hostname'] = "host2";
$config2['username'] = "user";
$config2['password'] = "x";
$config2['database'] = "database2";
$config2['dbdriver'] = "mysql";
$config2['dbprefix'] = "";
$config2['pconnect'] = TRUE;
$config2['db_debug'] = TRUE;
$config2['cache_on'] = FALSE;
$config2['cachedir'] = "";
$config2['char_set'] = "utf8";
$config2['dbcollat'] = "utf8_general_ci";

$this->conn2= $this->load->database($config2,TRUE)


$config['hostname'] = "host2";
$config['username'] = "user";
$config['password'] = "x";
$config['database'] = "database3";
$config['dbdriver'] = "mysql";
$config['dbprefix'] = "";
$config['pconnect'] = TRUE;
$config['db_debug'] = TRUE;
$config['cache_on'] = FALSE;
$config['cachedir'] = "";
$config['char_set'] = "utf8";
$config['dbcollat'] = "utf8_general_ci";

$this->conn3= $this->load->database($config,TRUE);



The conn2 end up using database3 instead of database2 when I try to query something

So Iam doing something wrong ?
#2

[eluser]jahbob[/eluser]
Anyone ? =\
#3

[eluser]greedyman[/eluser]
[quote author="jahbob" date="1372624668"]Anyone ? =\[/quote]

Did you find your answer on internet? I tried and found a lot.
#4

[eluser]jahbob[/eluser]
Im sorry but I really didnt finded....could u please send me the links that u found ?

Thanks
#5

[eluser]greedyman[/eluser]
[quote author="jahbob" date="1372711296"]Im sorry but I really didnt finded....could u please send me the links that u found ?

Thanks[/quote]

This is for you




Theme © iAndrew 2016 - Forum software by © MyBB