[Dbix-class] DBIx::Class vs. dbi:proxy

Brandon Black blblack at gmail.com
Fri Dec 15 14:05:23 GMT 2006


On 12/15/06, Marc Espie <espie at nerim.net> wrote:
> I'm trying to use DBIx::Class through dbi:proxy, the idea being that I want
> to get to an access database from a unix machine, and that the win32 odbc
> connector works just fine.
>
> I've used this setup through DBI proper without any issue, so I know it
> works. I've solved the first hurdle, namely I have to tell
> SQL::Abstract::Limit about the type of database handle, since it can't
> deduce it itself.
>
> However, now DBIx insists on ping'ing the dbh to make sure it's alive...
> and that doesn't work: dbi:proxy refuses to ping the dbh, saying I'm
> not authorized (I suspect that DBI passes commands through verbatim,
> and that the proxy server doesn't know how to do ping's simply, so it
> doesn't bother).
>
> I'm stumped. Any way to tell DBIx::Class to stop caring ?
>

->ping really needs to work, or you will always have problems with
DBIx::Class.  ->ping is how it is able to tell that your connection is
still alive and that it doesn'tneed to reconnect.  The development
branch doesn't ->ping on every statement like the current release, but
it still relies on ->ping's correct behavior in exception situations.

Rather than look for a way to make DBIx::Class stop caring, you should
look for the cause of the "not authorized" message, and get ping
working with your DBD's.  AFAICS, DBD::Proxy does support proxying
"ping", and DBD::ODBC does have a ping method.  You'll notice in the
DBD::ODBC source that the ping method looks a little fragile, likely
that's what's breaking on MSAccess.  There's also right below that an
"oldping" they saved for posterity.  Try hacking on that ping source
and come up with a valid ping method that reliably tells you the
database connection is still working.  "SELECT 42" and checking that
the DB successfully returned the value 42 is a good start for most SQL
databases.

-- Brandon



More information about the Dbix-class mailing list