Dear Monks,
I am trying to remotely to connect to a database using
DBI::ProxyServer,
DBD::Proxy and
DBD::mysql drivers.
The server is running on a Redhat
perl, v5.8.8 built for i386-linux-thread-multi and the client is
perl, v5.10.0 built for MSWin32-x86-multi-thread
I start the ProxyServer on the linux:
$ dbiproxy --configfile config.cfg
And have the follow code to test a connection
#!usr/bin/perl
use strict;
use warnings;
use DBI;
use DBD::Proxy;
use DBD::mysql;
# Configuration options to connect
my %config = (
host => 'xx.xx.xx.xx',
port => #####,
driver => 'mysql',
database => 'xxx',
user => 'xxx',
auth => xxxxxxxxxxxxxxxxxx,
);
# Create Data Source
$ENV{DBI_AUTOPROXY} = "hostname=$config{host};port=$config{port};";
my $dsn = "DBI:mysql:database=xxx";
# Connect / Create database handle
my $dbh = DBI->connect( $dsn, $config{user}, $config{auth} ) || die $D
+BI::errstr;
# Prepare query
my $sth = $dbh->prepare('SHOW TABLES');
# Execute query and fetch results
$sth->execute();
my $tables_ref = $sth->fetchall_arrayref(); # Works fine
$dbh->disconnect;
The code correctly retieves a list of tables in the required database. However the following non-fatal error occurs
Client side error:
DBD::Proxy::db connected failed: Server returned error: Failed to execute method CallMethod: Not permitted f
method connected of class DBI::ProxyServer::db at /usr/lib/perl5/site_perl/5.8.8/RPC/PlServer.pm line 326.
dbiproxy debug call:
I've tried debugging the dbiproxy and found where the problem is:
CallMethod: => DBI::ProxyServer::db=HASH(0xa150170),connected,DBI:mys
+ql:database=xxx,xxx,xxxxxxxxxxxxxxx
CallMethod died with: Not permitted for method connected of class DBI:
+:ProxyServer::db at /usr/lib/perl5/site_perl/5.8.8/RPC/PlServer.pm li
+ne 326.
The documentation metions a known issue with
Unproxied method calls, Thinking that perhaps this was it and
sub connected; wasn't added I opened up the source code for
DBD::Proxy package
DBD::Proxy::db but alas it wasn't the problem.
Since then i've been searching for a sollution and have only found one bug post on it
Debian Bug Post
I was wondering if any one knows what is going wrong ( or what I have done wrong ) and if there is an easy sollution.
I'm also aware you only need DBD::Proxy for drivers which don't support remote connection. And seeing as DBD::mysql as options for a host and port ( couldn't get it to work with
dbi:mysql:xxx;host=xx.xx.xx.xx;port=#####;) perhaps I don't need DBD::Proxy at all?
Could it be a problem with different versions of perl (5.8.8 and 5.10) or even releases of DBI::Proxy?
Many Thanks,
John
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.