OK, I know this should be easy and straight forward. But I'm having 
difficulty connecting to an Oracle database.
I am working on a machine that is connected, by lan, to the oracle server. 
This is some of the code I've tried:

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");
my $sth = $dbh->prepare("show tables");
$sth->execute;
print "<br><br><table class=\"data\" cellspacing=\"1\">\n";
while (my @results = $sth->fetchrow_array) {
print "<tr>\n";
foreach my $result(@results) {
print "<td>$result</td>\n";
}
print "</tr>\n";
}
print "</table>\n";

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. So I've also 
tried:
my $dbh = 
DBI->connect("DBI:Oracle:host=$hostname;database=$databaseName",$dbuser,$dbpass)
|| &Error("Cannot connect to database");

But this didn't change the outcome at all.
I checked with the database administrator and my server has access to the 
database.
What am I doing wrong? I connect to MySQL servers all the time. But I can't 
seem to connect to this oracle database.
Oh, I also checked to make sure that an Oracle driver is installed for DBI, 
and it IS.

Any ideas?
Thanks.

--Alex
 
_______________________________________________
Boston-pm mailing list
Boston-pm@mail.pm.org
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to