[dancer-users] Better Solution ?

Stefan Hornburg (Racke) racke at linuxia.de
Thu Apr 11 14:43:55 BST 2013


On 04/11/2013 03:20 PM, Hugues Max wrote:
> I'm going to migrate a very very old Microsoft Access application, during a certain time I need ton send and read  data in MS Access.
> I've compiled this small script for windows, and it run on same machine as MS Access and this script listen on port 2000
> 
> use strict;
> my @tableau;
> $tableau[0] ='--localport=2000';
> $tableau[1]='--debug';
> require DBI::ProxyServer;
> delete $ENV{IFS};
> delete $ENV{CDPATH};
> delete $ENV{ENV};
> delete $ENV{BASH_ENV};
> DBI::ProxyServer::main(@tableau);
> exit(0);
> 
> my connection is here
> 
> my $dsn      = "DBI:Proxy:hostname=$IP;port=$PORT;dsn=DBI:ODBC:$ODBC";
> my $dbh = DBI->connect($dsn, "", "") || die "Erreur de connexion à la base";
> 
> and
> my $sth = $dbh->prepare($sql);
> $sth->execute();
> 
> 
> 
> I tried to configure with config.yaml
> Plugins:
>     Database:
>         connections:
>         Access:
>                           driver: 'Proxy:hostname=192.168.0.19;port=2000;dsn=DBI:ODBC:myodbconnection'
> 
> 
> connection seem to be ok
> 
> how I can call db handle ?
> 
> if I use  something like
> 
>  my $line       = database('Access')->quick_select('CommandeBNP', {Ckey => params->{Ckey} } );
> 
> SQL language from |Dancer::Plugin::Database <https://metacpan.org/module/Dancer::Plugin::Database>;| is wrong and Access stop this this error
> 

my $dbh = database('Access');
my $sth = $dbh->prepare($sql);
$sth->execute();

database('Access') gives you DBI database handle object with some extra methods.

Regards
	Racke

-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the dancer-users mailing list