DBD::Proxy with Dancer
Hello I use my DBD::Proxy to connect my program to ODBC Access Database. with: my $dsn = "DBI:Proxy:hostname=$IP;port=$PORT;dsn=DBI:ODBC:$ODBC"; my $dbh = DBI->connect($dsn, "", "") || die "Erreur de connexion à la base"; $dbh->{AutoCommit} = 1; $dbh->{RaiseError} = 1; I would like to transpose this same connection using Dancer, in config.yml, but I do not arrive to pass good settings. login and password are empty plugins: Database: connections: accesssav: driver: "Proxy:hostname=192.168.0.19;port=2000;dsn=DBI:ODBC:accesssav" database: 'accesssav' username: '' password: '' port: 2000 connection_check_threshold: 3 #dbi_params: # RaiseError: 1 # AutoCommit: 1 #on_connect_do: ["SET NAMES 'utf8'", "SET CHARACTER SET 'utf8'" ] log_queries: 0 [5268] error @0.140813> [hit #1]Database connection failed - Cannot log in to DBI::ProxyServer: Refused by server: User is not permitted to connect. at /usr/local/share/perl5/RPC/PlClient.pm line 82. in /usr/local/share/perl5/Dancer/Plugin/Database.pm l. 16 I try lot of settings as driver: "Proxy:hostname=192.168.0.19;port=2000;dsn=DBI:ODBC:accesssav" driver: "Proxy:hostname=192.168.0.19;port=2000;dsn=DBI:ODBC:accesssav, '', '' " nothing works , someone has already test Dancer with DBD::Proxy ?
On Fri, 08 Nov 2013 23:28:03 +0100 Hugues <hugues@max4mail.com> wrote:
Hello I use my DBD::Proxy to connect my program to ODBC Access Database. with:
my $dsn = "DBI:Proxy:hostname=$IP;port=$PORT;dsn=DBI:ODBC:$ODBC"; my $dbh = DBI->connect($dsn, "", "") || die "Erreur de connexion à la base"; $dbh->{AutoCommit} = 1; $dbh->{RaiseError} = 1;
I would like to transpose this same connection using Dancer, in config.yml, but I do not arrive to pass good settings. login and password are empty
plugins: Database: connections: accesssav: driver: "Proxy:hostname=192.168.0.19;port=2000;dsn=DBI:ODBC:accesssav" database: 'accesssav'
You have a pre-crafted DSN, so you want to just use Dancer::Plugin::Database's "dsn" config option, like so: plugins: Database: connections: accessav: dsn: "DBI:Proxy:hostname=...." That should get it working for you. -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github
thanks david for your help I tried with ./bin/appl.pl , query works, and I get data, but sometime I've got this error, I re try and it's ok { "exception" : "Warning caught during route execution: Use of uninitialized value $driver in hash element at /usr/local/share/perl5/Dancer/Plugin/Database.pm line 188.\n", "error" : "Warning caught during route execution: Use of uninitialized value $driver in hash element at /usr/local/share/perl5/Dancer/Plugin/Database.pm line 188.\n" } or this error [Mon Nov 11 21:39:34 2013] [error] [client 192.168.0.19] DBD::Proxy::db connected failed: Can't store CODE items at /usr/local/lib64/perl5/Storable.pm line 339, at /usr/local/share/perl5/RPC/PlServer/Comm.pm line 91, referer: http://m.maison/ Le 11/11/2013 18:18, David Precious a écrit :
On Fri, 08 Nov 2013 23:28:03 +0100 Hugues <hugues@max4mail.com> wrote:
Hello I use my DBD::Proxy to connect my program to ODBC Access Database. with:
my $dsn = "DBI:Proxy:hostname=$IP;port=$PORT;dsn=DBI:ODBC:$ODBC"; my $dbh = DBI->connect($dsn, "", "") || die "Erreur de connexion à la base"; $dbh->{AutoCommit} = 1; $dbh->{RaiseError} = 1;
I would like to transpose this same connection using Dancer, in config.yml, but I do not arrive to pass good settings. login and password are empty
plugins: Database: connections: accesssav: driver: "Proxy:hostname=192.168.0.19;port=2000;dsn=DBI:ODBC:accesssav" database: 'accesssav' You have a pre-crafted DSN, so you want to just use Dancer::Plugin::Database's "dsn" config option, like so:
plugins: Database: connections: accessav: dsn: "DBI:Proxy:hostname=...."
That should get it working for you.
participants (2)
-
David Precious -
Hugues