Hello, all!

I'm working on some perl script and have problem connecting to mysql
server.
The problem is: it's ok if connecting to localhost, but can't connect
to other server.

Example:

### RDB.pm
require RErrorHandler;
require RHash;
require DBI;
package RDB;
@ISA=qw{ RHash };
my $connection='_CONNECTION';
my $statements='_STATEMENTS';
my $operator='_OPERATOR';
my $interface='interface';
my $driver='driver';
my $database='database';
my $host='host';
my $port='port';
my $username='username';
my $password='password';
# 1st - connecting to localhost - OK
sub create {
  my $this=shift;
  my $self=($this->SUPER::create(@_));
  
$self->{$connection}=DBI->connect($self->{$interface}.':'.$self->{$driver}.':'.$self->{$database},$self->{$username},$self->{$password});
  $self->{$statements}={};
  return $self;
}
# 2st - connecting to another server - WHAT'S WRONG?
sub create {
  my $this=shift;
  my $self=($this->SUPER::create(@_));
  
$self->{$connection}=DBI->connect($self->{$interface}.':'.$self->{$driver}.':'.$self->{$database}.'another.server.com:3306',$self->{$username},$self->{$password});
  $self->{$statements}={};
  return $self;
}

...

### login.pl
...
  $db=RDB->create(%{$cf->{NORMAL}{db}});
...

### cf
:db
interface=DBI
driver=mysql
database=databs
username=login
password=passwd

[EOE]

Can anyone help me?


Agris


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <mysql-unsubscribe-##L=##[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to