I am writing a data replication Utility, that currently pulls a list of
connection strings from a PG database 

The literal value of $sconnect_str is:
"dbi:Proxy:hostname=eddie;port=3334;dsn=dbi:ODBC:PLAY;",'username','password', 

Which seems to be getting passed just fine to &konnect, as $connect_str has
this value in it while in &konnect for this itteration, it does NOT get the
value in it if I put single quotes around $connect_str (i.e.  '$connect_str')
as is shown in Programming the DBI, (I wouldn't expect it to since single
quotes don't interpolate...).   So the error I get does not make sense to me at
all...as I have tested and verified that DBI::Proxy is installed.

I'm getting the following Error:

Can't
connect("dbi::Proxy:hostname=eddie;port=3334;dsn=dbi:ODBC:PLAY;",'username','pa
ssword', HASH(0x8144e80)), no database driver specified and DBI_DSN env var not
set at /root/bin/sync_v1.pl line 57.

And here's the code snippet:
#
# Connect to a databai.
#
sub konnect(){
my $connect_str=shift;
print "I'm in KONNECT $connect_str.\n";
my $dbh = DBI->connect($connect_str,                      {
                                RaiseError => 1,
                                AutoCommit => 0
                                }
                        )  || die "Database Connection failed: $DBI::errstr";

}


#Begin Loop through @databai to connect to the databai and start sync.


for $srow ( @src_databai ) {
  $sconnect_str=$srow->[1]; # Get Connect String for Current Src database
  $dbh_src=&konnect($sconnect_str);  #Connect to the database
  print "have connected to $sconnect_str)\n";
  for $drow (@dest_databai) {        #Loop for connecting to Source databai.
    if (! $srow->[1]==$drow->[1]) {  #Verify Dest & Src are not Same DB.
       my $tmp=$drow->[1];      #Get Connect String for Current Dest
       $dconnect_str=$tmp;
       $dbh_dest=&konnect($dconnect_str);               #Connect to Current
Dest.
      #CODE To Get List of Updates from Source
      $sql = qq( SELECT * FROM up );
#(SOME STATEMENT TO CREATE OR GRAB A VIEW OF SyncObjects Joined with SyncRecords)
      $sth_src=$dbh_src->prepare( $sql );
      $sth_src->execute();
      print "grabbing list of updates\n";
      while (my $array_ref = $sth_src->fetchrow_arrayref){
    push my @src_sync, [@$array_ref];  # copy the array contents.
   }


-- 
Michael Wray
Network Administrator
FamilyConnect, Inc.


Reply via email to