On Thu, Sep 15, 2005 at 01:30:54PM -0400, Alex Brelsfoard wrote: > my $databaseName = 'nameOfDatabase'; > my $dbuser = 'me'; > my $dbpass = 'myPass'; > my $hostname = 'my.oracle.server'; > > my $dbh = DBI->connect("DBI:Oracle: $databaseName",$dbuser,$dbpass) || > &Error("Cannot connect to database");
> All that happens is I get the "Cannot connect to database error". The > connection is not working. > I noticed that there is no specification of where the database is being > hosted. Granted all the examples I found for using DBI to connect to an > oracle database never specified one either. But I just figured that it was > because their oracle db is on the same server. Mine is not. If you use the database name syntax, then the ORACLE_HOME environment variable must be set, and the database name must be defined in the tnsnames.ora file, which will specify the host and sid for the database. (I'm not sure a space is allowed before the database name, but maybe it's just ignored.) my $dbh = DBI->connect("dbi:Oracle:$databaseName",$dbuser,$dbpass) If the database name is not defined in tnsnames.ora, you can specify host and sid in the connect instead. my $dbh = DBI->connect("dbi:Oracle:host=$hostname;sid=$sid",$dbuser,$dbpass) HTH, Ronald _______________________________________________ Boston-pm mailing list Boston-pm@mail.pm.org http://mail.pm.org/mailman/listinfo/boston-pm