Hi,
I am trying to use Dance::Plugin::Database with SQLite in a situation where different databases must be connected to in different routes. For example:
get route_1 => sub {
my $dbfile_1 = "...";
my $dbh = database({
driver: 'SQLite',
database => $dbfile_1,
.... Other Options
});
... Work with $dbh
}
get route_2 => sub {
my $dbfile_2 = "...";
my $dbh = database({
driver: 'SQLite',
database => $dbfile_2,
.... Other Options
});
... Work with $dbh
}
My Config file contains:
plugins:
Database:
driver: 'SQLite'
Since I dont know what the database is going to be I dont have the database setting here (probably incorrect, but I dont know any better)
After a few routes I begin to get this error:
Can't connect to data source 'dbi:SQLite' because I can't work out what
driver to use (it doesn't seem to contain a 'dbi:driver:' prefix and the
DBI_DRIVER env var is not set) at
/home/nandan/perl5/perlbrew/perls/perl-5.14.2/lib/site_perl/5.14.2/Dancer/Plugin/Database.pm
line 163
Could you suggest the correct way to set the database dynamically in each route?
Thank you