[dancer-users] how to make sure one db connection per user

WK wanradt at gmail.com
Fri Sep 18 17:32:20 BST 2015


Hi!

2015-09-18 19:09 GMT+03:00 Dancer New <dancerfan2015 at gmail.com>:

> I use Dancer::Plugin::Database in my application. Each time when
> $dbh = DBI->connect( $c->{ dsn }, $c->{ username }, $c->{ password}, $c->{
> dbi_params })
> is called. does it return a new connection?

Yes, it does. But then is no point to use Dancer::Plugin::Database at all.

> I would like one db connection for each user, where can I save the database
> handler?

Could you elaborate, why every user must have their own connection? It
does not seem reasonable. Using just one connection over the
application is much cheaper way. When using Dancer::Plugin::Database
you must set up connection data in config file.


Wbr,
-- 
Kõike hääd,

Gunnar


More information about the dancer-users mailing list