DBD::Oracle and instant client - can't find tnsnames.ora

Hi all! :-)

Guys, please, help!

My OS: CentOS 6.6, i386

Installed:

Oracle - instantclient12.1 - basic - 12.1.0.2.0 - 1.i386

Oracle - instantclient12.1 - devel - 12.1.0.2.0 - 1.i386

Oracle - instantclient12.1 - sqlplus - 12.1.0.2.0 - 1.i386

Perl-DBI-1, 609 - 4.el6.i686

and last perl-DBD-Oracle-1, 74-CPAN.

Apache 2.2.15, mod_perl 2.0.4

SELinux disabled.

ORACLE_HOME = usr/lib/oracle/12.1/client, LD_LIBRARY_PATH = /usr/lib/oracle/12.1/client/lib

tnsnames.ora exist in /usr/lib/oracle/12.1/client/network/admin

I wrote a simple perl script to test the connection:

use strict;
use DBI;

my $dbh = DBI ->connect("dbi:Oracle:crm", 'login', 'password',{RaiseError => 1} );
$dbh->disconnect();

When I try to run script command line - everything isn't ok, no errors (Yes, I can run queries, etc... )

But!

With apache, I get an error:

DBI connect('crm','login',...) failed: ORA-12154: TNS: could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) in /opt/otrs/bin/cgi-bin/oratest.pl on line 9

I am trying to add ORACLE_HOME with PerlSetEnv and script see (I checked through % ENV), but no luck.

Probably easier to use EZconnect instead of tnsnames.ora:

$machine = 'my.oracle.database.com';
 $port = 1521;
 $sid = 'my_sid';
 $dbh = DBI->connect("dbi:Oracle://$machine:$port/$sid", $user, $pass) ||
  die "Failed to connect: $DBI::errstr\n";

Tags: Database

Similar Questions

Maybe you are looking for

  • How can multiple users with unique IDS share iTunes game if the primary device is not in the room?

    I have a pregnant House Sonos and iTunes game on my computer, but my husband can't use it unless my device is turned on and the House.  If I also get the family plan of Apple's music that will solve the problem?  Also it can download new music in its

  • Display in Windows Mail problem

    Original title: Outlook.com Title changed to "Display in WLM problem." Although he can be independent, when I logged on this AM, I had IE 9 privacy statement. When I open Windows Mail, lack of it for the first time ever was, on the far left of the sc

  • My recycling bin has disappeared and I can't.

    My brother went on my laptop and after that he had finished, he said that it "deleted" my recycling bin. I don't know if this is what happened, but I can't. I have searched for it, and does not appear. Help is greatly appreciated.

  • get the TextInput text inside the different function?

    It's all in a single class method 1: var txtInpt:TextInput = new TextInput();txtInpt.width = 250;searchInpt.text = "Text";txtInpt.addEventListener(MouseEvent.CLICK, clearSearch);txtInpt.addEventListener(KeyboardEvent.KEY_DOWN, onKeyBoardEvent);MyCont

  • a necessary component of windows media does not start Please restart windows media

    When I try to read 'My Favorites' in Windows Media, I always get the box that says I have not implemented yet and I'd like to, I'm going through so pick up options I want to choose Save then I get the error mssg that says "a necessary component of wi