By: joris
Date: 2007-06-09
Time: 18:35
|
Multiple DB connections... Help?Hi all,
I am having problems using TBS... I happen to have 2 DB connections to different DB's. Using only the first one goes just fine. After opening a second connection (and saving the resource ID) TBS uses the second DB connection, instead of the first one. Is it possible to add the database resource ID to TBS so that it uses the right DB connection? I keep getting these types of errors (which make sense):
Please let me know if I am missing something (even if its possible) Thanks in advance! Joris |
|||||||
By: Skrol29
Date: 2007-06-10
Time: 01:10
|
Re: Multiple DB connections... Help?Hi,
You can use the PHP resource handler of your MySQL connection for the MergeBlock() call. Thus you can manage as many MySQL connection as you wish.
|
|||||||
By: joris
Date: 2007-06-10
Time: 13:12
|
Re: Multiple DB connections... Help?Sweet!
Thank you very much! |
|||||||
By: joris
Date: 2007-06-11
Time: 20:33
|
Re: Multiple DB connections... Help?Hi,me again...
Still don't work :( I now used tbsSql (which is great by the way!) This works:
Then, if I try to use the resource id from tbsSql it doesn't...
This is because $db->Id equals 1 Trying just by using $db also doesn't work...
Can anybody help me? By the way: This also doesn't work for me?
that should give something like this:
but it gives
|
|||||||
By: Skrol29
Date: 2007-06-11
Time: 23:42
|
Re: Multiple DB connections... Help?Hi,
Just try:
|
|||||||
By: joris
Date: 2007-06-12
Time: 18:15
|
Re: Multiple DB connections... Help?Me again...
Call me crazy... That is just what I do... But it does not work... :(
Looking a bit further... the output of this script is:
"no resource" $db->Id = true when I look in the class I see the following function: _Dbs_Prepare() It sets the $this->Id to true... After _Dbs_Connect had set it to the resourceID...? Why is that? If I comment that part
It works fine... |
|||||||
By: Skrol29
Date: 2007-06-15
Time: 14:05
|
Re: Multiple DB connections... Help?Hi,
Which TbsSQL are you using ? I mean which file exactly ? |
|||||||
By: joris
Date: 2007-06-15
Time: 14:15
|
Re: Multiple DB connections... Help?// TbsSql Engine
// Version 2.0, 2007-03-01, Skrol29 That would be this version But I discovered that I was making 2 db connections to the same server. Then PHP uses connection pooling. Thats why it was sharing the 1 db resource id in the two connections. (Also see: www.php.net/mysql_connect and http://www.php.net/mysql_select_db) The documentation there speaks of conection pooling When I made 1 with "localhost" and 1 with "127.0.0.1:3306" it all worked just fine. But I altered the class myself when it connects I add the variable $this->Resourceid... Then everything works perfect. |
|||||||
By: Skrol29
Date: 2007-06-16
Time: 00:11
|
Re: Multiple DB connections... Help?Ok, if it works then...
But I was asking which file name because it can be "tbssql_mysql.php" or "tbssql_mysqli.php". |