Arav
Arav

Reputation: 5247

Regarding perl dbd oracle

I have two queries

  1. When i run the below perl script i am getting the below error

Unable to connect: ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach)

I can't modify the tnsnames.ora as i dont have access. I know tnsnames.ora doesn't have a entry for testdb database. Is there a workaround. Thought i am accessing the database in the remote solaris machine with the IP Address so no need of a entry in the local solaris machine tnsnames.ora.

$platform = "Oracle";
$database = "testdb";
$host = "testdb.dev.test.com.au";
$port = "2000";
$user = "scott";
$pw = "tiger";


$dsn = "dbi:$platform:$database:$host:3306";
print "$dsn" . "\n";

# PERL DBI CONNECT (RENAMED HANDLE)
my $dbstore = DBI->connect($dsn, $user, $pw) or die "Unable to connect: $DBI::errstr\n";

2 My understanding about DBD module is even oracle is not installed in the local machine DBD module should work. But i noticed while installation it uses oracle client libraries. So if i install a DBD::Sybase do i need to have a installation of sysbase in local machine. Since I am accessing remote server database thought why local installation of oracle/sybase libraries are required?

Upvotes: 2

Views: 2069

Answers (1)

slayedbylucifer
slayedbylucifer

Reputation: 23502

your dsn syntax is wrong. try to make it look like below:

$dsn = "dbi:$platform:host=$host;sid=$sid;port=$port";

Above syntax has worked for me in numerous cases where I had used DBD::Oracle.

Upvotes: 3

Related Questions