Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have inherited some code, well actually alot of code that needs to be installed for a new client. The original author seems to be intentionally avoiding helping me out and has provided very little assistance, thus I am turning to you for some guidance.
The code that he is using to connect with DBI is as follows...
The confusing part is the connect string is defined via a custom apache environment variable which he instructs as follows...sub new { my ($class, %flags) = @_; my ($self) = {}; bless $self, ref($class) || $class; my $server = $flags{'-server'} || $ENV{'DBISERVER'} || die "No ser +ver specified!\n"; my $user = $flags{'-user'} || 'undef'; my $pass = $flags{'-pass'}; $self->{_DB_NORM_HANDLE} = DBI->connect('dbi:' . $server, $user, $ +pass, { RaiseError => 0, AutoCommit => 1 } ) or croak "Cannot connect + to $ENV{'DBISERVER'}\n"; return $self; }
I can handle this within the httpd conf file or even htacess, but what is the correct syntax?DBISERVER <dbi connect string>
Additionally, the DBI->connect string needs to be able to connect to a specific database on a remote server which is not accounted for in his code.
1) What changes are to be made to the DBI->connect?
2) How do I properly define the custom environment variable
Could someone assist in this matter assuming the following variables...
remote host: somedomain.com mySQL DB: main_DB mysql user: charlie mysql pass: opensesameTIA for any guidance...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI question
by Roger (Parson) on Jan 15, 2004 at 06:25 UTC |