j4mie / idiorm

A lightweight nearly-zero-configuration object-relational mapper and fluent query builder for PHP5.
http://j4mie.github.com/idiormandparis/
2.01k stars 369 forks source link

Multiple Connection Problem #311

Closed FAYSVR closed 7 years ago

FAYSVR commented 7 years ago

I'm trying to connect to two different databases, The logic is as follows; I connect to the login database on the login page when the site is opened, Different database information is kept for each user in this login database, I try to create a new connection with the database information comes login database during user login...

This Login Database Connection named: 'remote';


ORM::configure("mysql:host=$db_host;dbname=$db_name" , NULL , 'remote'); ORM::configure('username', 'root', 'remote'); ORM::configure('password', '', 'remote'); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'remote'); ORM::configure('return_result_sets', true , 'remote'); ORM::configure('logging', true , 'remote');


Running code when logging in If the login check is successful ;

$db_host1 = $d['dbhost']; $db_user1 = $d['dbuser']; $db_password1 = $d['dbpass']; $db_name1 = $d['dbname'];

ORM::configure("mysql:host=$db_host1;dbname=$db_name1", NULL , 'new'); ORM::configure('username', $db_user1 , 'new'); ORM::configure('password', $db_password1 , 'new'); ORM::configure('driver_options', array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'), 'new'); ORM::configure('return_result_sets', true, 'new'); ORM::configure('logging', true, 'new');


named 'new' connection is not success, When I' running the active connection names;


print_r (ORM::get_connection_names());


Response; Array ( [0] => remote )


Only one connection looks,

Pls Help Me, Where is my mistake???

treffynnon commented 7 years ago

Do you get any error messages?

FAYSVR commented 7 years ago

No , There are no error messages..

FAYSVR commented 7 years ago

No , There are no error messages..

iPhone'umdan g?nderildi

Simon Holywell notifications@github.com<mailto:notifications@github.com> ?unlar? yazd? (15 Ara 2016 03:01):

Do you get any error messages?

- You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/j4mie/idiorm/issues/311#issuecomment-267195317, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AXcD78LoCMn8hMW9j8YiviEof30zE_mDks5rIIMkgaJpZM4LNi5u.

FAYSVR commented 7 years ago

Hi, I'm waiting for an answer to this question, Please..

treffynnon commented 7 years ago

Well I've not seen this problem before. It worked for me when I last tested it. Have you got error reporting turned on? Have you watched your database server logs during connection?

On 18 Dec 2016 7:12 a.m., "FAYSVR" notifications@github.com wrote:

Hi, I'm waiting for an answer to this question, Please..

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/j4mie/idiorm/issues/311#issuecomment-267787193, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD-v-BEvb-BwDPgF2tx_o2BJPBIBH80ks5rJFBFgaJpZM4LNi5u .

FAYSVR commented 7 years ago

I solved the problem. It was not because I wrote second connection codes on the login controller page, I passed it to the boot page, Now two connections are seems.. Thank you.