[Sqlrelay-discussion] Perl DBI API to connect to diferent db
Brought to you by:
mused
|
From: Albert V. <av...@im...> - 2005-12-14 19:22:06
|
Hi all,
I've just downloaded and tried the sqlrelay application. It looks
great, however, I have a problem trying to connect using more than one db.
I have the following conf:
<instances>
<instance id="example" port="9000" socket="/tmp/example.socket"
dbase="mysql" connections="3" maxconnections="15" maxqueuelength="5"
growby="1" ttl="60" endofsession="commit" sessiontimeout="600"
runasuser="nobody" runasgroup="nobody" cursors="5" authtier="listener"
handoff="pass" deniedips="" allowedips="" debug="listener_and_connection">
<users>
<user user="mysqltest" password="mysqltest"/>
</users>
<connections>
<connection connectionid="db1"
string="user=yyy;password=xxx;db=db1;host=myhost" metric="1"/>
<connection connectionid="db2"
string="user=yyy;password=xxx;db=db2;host=myhost" metric="1"/>
</connections>
</instance>
</instances>
And i'm using the dbi api this way:
my
$dbh=DBI->connect("DBI:SQLRelay:host=localhost;port=9000;socket=","mysqltest","mysqltest");
The problem is how can I choose between one connection or another?
For example, I have this two querys:
select * from table_1 -> this query must run over the connectionid db1.
select * from table_2 -> this query must run over the connectionid db2.
I've not found the way to deal with this problem, because using
DBI->connect method I cannot set the connectionid parameter. If I use
the DBI->connect method, one query works fine and the other one not.
Am I doing something wrong?
Thanks in advance.
|