looks like one database from the outside, but it's two inside



Overview: I'm trying to create the situation in the subject line:
from the outside, the database handle thinks it's just one database,
but inside it's really two databases containing tables with the same
schema but not necessarily the same data.

Specifics: Where I work we have a web site with content determined
jointly by user interaction and by data in various tables in a very
large database. I would like to test what would happen if I add other
data to the database. Typically what I have to do is copy the
relevant parts of the very large database to my box, add in the new
data, and test locally. (The very large database is far too large to
copy between machines.)

There are a number of things that make this setup difficult:

1) Determining what is "relevant" is not always an easy task and is
often fraught with errors.

2) The very large database can be modified by many, many other people
at will. So, each time I perform a test, I have to go back to the
very large database and copy the relevant parts to my box.

3) Handles to the database are created through an intermediary module.
So, the call XXX::DBH->new('YYY') (where XXX::DBH is a subclass of
DBI::db) returns a $dbh to the correct database (names have been
changed to protect the innocent). This module relies on a
configuration file to turn 'YYY' into the correct parameters for
DBI->connect(); that means I'm always fiddling with the configuration
file, depending if I want to use the original very large database or
my local one.

4) I'd like to fiddle with the original code as little as possible,
including the intermediary module.

My thoughts have turned to something like DBD::Proxy, because then I
could just change the environment variable DBI_PROXY when needed to
switch between servers. But DBI::ProxyServer doesn't seem very easily
adaptable to this situation; it seems restricted to the rather
specific task of acting as a proxy for another driver.

I have also thought about writing a driver from scratch, using
SQL::Statement to help out, but that breaks the first rule of driver
writing ("Don't!"), and since this is for my job, the second rule
("Don't -- get someone else to do it for you!") isn't really an
option.

I'm not afraid of putting in the time to do this right, and I'm not
trying to get something for free. But I'd like some opinions about
what might be the correct approaches to this problem, especially if
there's something obvious that I've overlooked. (So OK, I'm trying to
get some advice for free :)

Thanks.
.



Relevant Pages

  • Re: JDBC URL for Oracle Database With Failover (2 db servers)
    ... After you've loaded the driver, you can establish a connection using ... each form requires a database URL. ... For Oracle, the database URL has ...
    (comp.lang.java.databases)
  • RE: New JDBC 1.2 driver runs slower than JDBC 1.1; my db definitio
    ... If the support incident ends up verifying a slowdown in the new driver, ... New JDBC 1.2 driver runs slower than JDBC 1.1; ... I do think this would happen in general, not just for my database; ...
    (microsoft.public.sqlserver.jdbcdriver)
  • RE: Import external data - web query
    ... Your reply for my query is very extensive, this is for importing a file from ... The data source I want isn't listed in the Select Data Source dialog box. ... information used to connect to a database. ... Check your driver First, make sure you have the right ODBC driver (Open ...
    (microsoft.public.excel.misc)
  • Re: resultset is an iterator?
    ... >> done by the JDBC driver and the database backend. ... >> drag it all into memory but I have noticed that MySQL seems to do this. ... ResultSets are completely retrieved and stored in memory. ...
    (comp.lang.java.databases)
  • Re: MySQL JDBC driver - implications for non-GPLed apps
    ... >> driver a particular user wants to implement. ... MySQL AB does not purport to be our ... > care to provide a clear-cut explanation as part of their license agreement. ... >> However then you look at it, is the value of the driver and database ...
    (comp.lang.java.databases)