in reply to Database connection over a network without having a local TNS entry

Yes -- you can specify the hostname and port in the DSN string. From DBI, it says that the dsn is dbi:DriverName:database=database_name;host=hostname;port=port

Are you on oracle? What is your value for $dsn?
The DBD::Oracle page has a section on "Connecting without environment variables or tnsname.ora file" that has the example (you can also use port= with it):
$dbh = DBI->connect("dbi:Oracle:host=myhost.com;sid=ORCL", $user, $pa +sswd);

Replies are listed 'Best First'.
Re^2: Database connection over a network without having a local TNS entry
by Nesh (Beadle) on Jun 20, 2005 at 21:43 UTC
    Hi Thanks for the reply. I am using Oracle database. Suppose database host is neshat; port is 1521 and database name is abcd. I did it as
    $dbh = DBI->connect("dbi:Oracle:database=abcd;host=neshat;port=1521", +$user, $password, {PrintError => 1, RaiseError => 1}) or die "Can't e +xecute statement: $DBI::errstr";
    Still it gives me error. Where am I wrong? Thanks for your help.
      So what's the (exact) error message?

      What about the obivous questions of correct user/password values and firewall issues?
        The error message is
        C:\Neshat\Perl-Scripts>perl dbconn.pl DBI connect('database=FO;host=neshat.com;port=1521','abcd',...) failed +: Can't connect using this syntax without specifying a HOST and a SID at dbconn.pl line 9
        I am able to connect using the same parameters using jdbc. So I don't think that there should be any firewall issue. But still I am not very sure.