ORA-12154

--0-1375756846-1091566308=:54889
Content-Type: text/plain; charset=us-ascii

Hi list
Command line script test2-cgi works fine but when I try from the browser it is giving the following error
 
DBI connect('db1','report',...) failed: Error while trying to retrieve text for error ORA-12154 (DBD ERROR: OCIServerAttach) at /home/report/www/cgi-bin/test2-cgi line 72

I have complete ORACLE environment set, I can connect using sqlplus and also can run tnsping the database without any issues at command prompt. 
 
Anyone know how to fix this issue?.
 
Thanks in advance



--0-1375756846-1091566308=:54889--
0
rgoud
8/3/2004 8:51:48 PM
perl.dbi.dev 1955 articles. 0 followers. Follow

4 Replies
691 Views

Similar Articles

[PageSpeed] 1

--0-954105539-1091567053=:66648
Content-Type: text/plain; charset=us-ascii

I am also attaching the test2-cgi script
#!/usr/bin/perl -w
#use strict;
use DBI;
use HTML::Template;
use CGI::Carp qw/fatalsToBrowser/;

my $connect     = "DBI:Oracle:db1";     # Database server path
my $login       = 'report';                             # Database username
my $passwd      = 'report';                     # Database password
#my $cgi  = new CGI_Lite;
#my %passedinput = $cgi->parse_form_data;       
my ($dbh, $sth);
# *********************************************************************************
&openconnection;
$sql = "SELECT url,unique_registered,total_hits 
FROM rptinfo
WHERE username='munikuntlar'
AND month='JAN'";
$sth = $dbh->prepare($sql);
$sth->execute;
while (($url,$unique_registered,$total_hits) = $sth->fetchrow()) {
my %row_data;
$row_data{url} =$url;
$row_data{unique_registered} =$unique_registered;
$row_data{total_hits} =$total_hits;
push(@unique_list, \%row_data);
        }
        $sth->finish;
&displayresults;
&closeconnection;
 
# *********************************************************************************
sub displayresults {
        my $template = HTML::Template->new(filename => '../test/test.tmpl');
        #$template = HTML::Template->new(filename => '../test/test.tmpl');
        #$template->param('unique_list',\@unique_list);         # TMPL LOOP Topics List
        if (!@unique_list) {                                                            # TMPL LOOP FAQ List
                $template->param('nounique_list','1');
                } else {
                $template->param('unique_list',\@unique_list);
                }
        
        # send the obligatory Content-Type and print the template output
print "Content-Type: text/html\n\n", $template->output;
        
        #print "Content-Type: text/html\n\n";                           # send the obligatory Content-Type
        #print $template->output;                                                       # print the template
}
sub openconnection {
        $dbh = DBI->connect($connect,$login,$passwd,{RaiseError => 1, AutoCommit => 1}) or die "Cannot connect to database";
}

sub closeconnection {
        $sth->finish;
        $dbh->disconnect;
}


Robert <rgoud@yahoo.com> wrote:
Hi list
At command line script test2-cgi works fine but when I try from the browser it is giving the following error

DBI connect('db1','report',...) failed: Error while trying to retrieve text for error ORA-12154 (DBD ERROR: OCIServerAttach) at /home/report/www/cgi-bin/test2-cgi line 72

I have complete ORACLE environment set, I can connect using sqlplus and also can run tnsping the database without any issues at command prompt. 

Anyone know how to fix this issue?.

Thanks in advance





--0-954105539-1091567053=:66648--
0
rgoud
8/3/2004 9:04:13 PM
This should be on the dbi-users list.  Are you sure all of the
environment variables are set?  Can you show the code?  The 
ORA-12154 is TNS error, 

12154, 00000, "TNS:could not resolve service name"
// *Cause:  The service name specified is not defined correctly in the
// TNSNAMES.ORA file.
// *Action:  Make the following checks and correct the error:
//           - Verify that a TNSNAMES.ORA file exists and is in the
proper
//             place and accessible. See the operating system specific
manual
//             for details on the required name and location.
//           - Check to see that the service name exists in one of the
//             TNSNAMES.ORA files and add it if necessary.
//           - Make sure there are no syntax errors anywhere in the
file.
//             Particularly look for unmatched parentheses or stray
characters.
//             Any error in a TNSNAMES.ORA file makes it unusable. See
//             Chapter 4 in the SQL*Net V2 Administrator's Guide. If
//             possible, regenerate the configuration files using the
Oracle
//             Network Manager.


....in other words it doesn't know the db you are trying to connect to,
which means the ORACLE_SID is not set or it is wrong in your connect 
statement.  Posting the code would help.


On Tue, 2004-08-03 at 15:51, Robert wrote:
> Hi list
> Command line script test2-cgi works fine but when I try from the browser it is giving the following error
>  
> DBI connect('db1','report',...) failed: Error while trying to retrieve text for error ORA-12154 (DBD ERROR: OCIServerAttach) at /home/report/www/cgi-bin/test2-cgi line 72
> 
> I have complete ORACLE environment set, I can connect using sqlplus and also can run tnsping the database without any issues at command prompt. 
>  
> Anyone know how to fix this issue?.
>  
> Thanks in advance
> 
> 
0
shildret
8/3/2004 9:06:17 PM
I would try setting the $ENV{ORACLE_HOME}, $ENV{LD_LIBRARY_PATH}, ..etc
in the top of the script, i.e.

BEGIN { 
    $ENV{ORACLE_HOME}     =  q[/some/path/to/oracle];
    $ENV{LD_LIBRARY_PATH} = qq[$ENV{ORACLE_HOME}/lib];
}
 
On Tue, 2004-08-03 at 16:04, Robert wrote:
> I am also attaching the test2-cgi script
> #!/usr/bin/perl -w
> #use strict;
> use DBI;
> use HTML::Template;
> use CGI::Carp qw/fatalsToBrowser/;
> 
> my $connect     = "DBI:Oracle:db1";     # Database server path
> my $login       = 'report';                             # Database username
> my $passwd      = 'report';                     # Database password
> #my $cgi  = new CGI_Lite;
> #my %passedinput = $cgi->parse_form_data;       
> my ($dbh, $sth);
> # *********************************************************************************
> &openconnection;
> $sql = "SELECT url,unique_registered,total_hits 
> FROM rptinfo
> WHERE username='munikuntlar'
> AND month='JAN'";
> $sth = $dbh->prepare($sql);
> $sth->execute;
> while (($url,$unique_registered,$total_hits) = $sth->fetchrow()) {
> my %row_data;
> $row_data{url} =$url;
> $row_data{unique_registered} =$unique_registered;
> $row_data{total_hits} =$total_hits;
> push(@unique_list, \%row_data);
>         }
>         $sth->finish;
> &displayresults;
> &closeconnection;
>  
> # *********************************************************************************
> sub displayresults {
>         my $template = HTML::Template->new(filename => '../test/test.tmpl');
>         #$template = HTML::Template->new(filename => '../test/test.tmpl');
>         #$template->param('unique_list',\@unique_list);         # TMPL LOOP Topics List
>         if (!@unique_list) {                                                            # TMPL LOOP FAQ List
>                 $template->param('nounique_list','1');
>                 } else {
>                 $template->param('unique_list',\@unique_list);
>                 }
>         
>         # send the obligatory Content-Type and print the template output
> print "Content-Type: text/html\n\n", $template->output;
>         
>         #print "Content-Type: text/html\n\n";                           # send the obligatory Content-Type
>         #print $template->output;                                                       # print the template
> }
> sub openconnection {
>         $dbh = DBI->connect($connect,$login,$passwd,{RaiseError => 1, AutoCommit => 1}) or die "Cannot connect to database";
> }
> 
> sub closeconnection {
>         $sth->finish;
>         $dbh->disconnect;
> }
> 
> 
> Robert <rgoud@yahoo.com> wrote:
> Hi list
> At command line script test2-cgi works fine but when I try from the browser it is giving the following error
> 
> DBI connect('db1','report',...) failed: Error while trying to retrieve text for error ORA-12154 (DBD ERROR: OCIServerAttach) at /home/report/www/cgi-bin/test2-cgi line 72
> 
> I have complete ORACLE environment set, I can connect using sqlplus and also can run tnsping the database without any issues at command prompt. 
> 
> Anyone know how to fix this issue?.
> 
> Thanks in advance
> 
> 
> 
> 
0
shildret
8/3/2004 9:19:11 PM
On Tue, Aug 03, 2004 at 04:06:17PM -0500, Scott T. Hildreth wrote:
> This should be on the dbi-users list.

So anyone replying should edit the CC to only include dbi-users@perl.org
Thanks.

Tim.
0
Tim
8/3/2004 10:26:48 PM
Reply:

Similar Artilces:

DBI:Oracle failure ORA-12154
I run locally a client script which fails with the following message: ORA-12154: TNS:could not resolve service name (DBD ERROR: OCIServerAttach) at ... DBI::connect('DBI','dbi:Oracle:abc','batman','secret','HASH(0x82d7910)') called at ... The datasource seems ok to me, and I checked from 'tnsnames.ora' that the port is set up to the default 1521 and the name is 'abc'. Any idea of what could be the problem? -- Claude ------=_Part_3297_7851276.1134139779099 Content-Type: text/plain; charset=ISO-8859-1 Con...

test DBD::Oracle DBI connect('','user/password@database',...) failed: ORA-12154
--0-621501335-1235620987=:55352 Content-Type: text/plain; charset=us-ascii I can connect to the database using sqlplus as user oracle, but not as root. I can compile DBD::Oracle but not complete the test. I tried to set variables properly: ORACLE_HOME=/u/oracle/10.2.0 ORACLE_HOST=hostname ORACLE_PORT=1522 ORACLE_SID=databasename ORACLE_USERID=user/password@databasename PATH=/u/oracle/10.2.0/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin PWD=/usr/src/pub/dbd-oracle/DBD-Oracle-1.22 TNS_ADMIN=/u/or...

ORA
Hello, I have a problem to access to oracle database with asp.net 1.1. I have a database server Oracle 8i on a machine. I have an other machine with a IIS server and Oracle CLIENT 9i. I try to access with the Oracle Data Provider (ODP 9.2) OR whith system.data.oracleclient but i have alway the same error message: ORA-12154: TNS Symbolic adress could not be resolved I can log on database with SQLPlus or with VB.net application but not with asp.net. I give to IUSR, IWAN and ASPNET user right on ORACLE920 directory. code part:Dim con As New Oracle.DataAccess.Client.OracleCo...

RE: Identifying the server connected to via DBI->connect("dbi:Ora cle:")
The output from tnsping (or tnsping80) contains the host name. C:\TEMP>tnsping db1 TNS Ping Utility for 32-bit Windows: Version 8.1.7.1.0 - Production on 12-JUL-2001 23:43:26 (c) Copyright 1997 Oracle Corporation. All rights reserved. Attempting to contact (ADDRESS=(PROTOCOL=TCP)(Host=db3serv)(Port=1521)) OK (100 msec) Also, in the later version of Oracle: select HOST_NAME from v$instance; -----Original Message----- From: Jeff Holt [mailto:jeff.holt@hotsos.com] Sent: Thursday, July 12, 2001 12:30 PM To: dbi-users@perl.org Cc: Tim.Bunce@ig.co.uk; Cary Millsap Sub...

ORA-12638 DBI->connect(nirvana) failed: ORA-12638: Credential r etrieval failed (DBD ERROR: OCIServerAttach)
ORA-12638 DBI->connect(nirvana) failed: ORA-12638: Credential retrieval failed (DBD ERROR: OCIServerAttach) Can anyone help me with the above error message? (Environment describe below.) I am trying to run this Perl script. MAOtestORA.pl At this point I'm just trying to get the connect to work, not trying to do anything with the data retrieved. #!/usr/local/bin/perl use DBI; use CGI::Form; use CGI::Carp qw(carpout); carpout(STDOUT); $dbh = DBI->connect("dbi:Oracle:nirvana", "system", "umntest") or die "Cannot Connect"...

ORA-12154 message
Hi, all, Since I can't get Oracle Client 9i ot 10g, I just down grade my PERL to 5.6.1 Build 638, and try to connect to ORACLE 8i. However, I get the following message: "DBI connect('MAIN01','owner',...) failed: ORA-12154: TNS:could not resolve the connect identifier specified (DBD ERROR: OCIServerAttach) at con_db.pl line 9" Does anyone know to solve this problem? Thanks Angela ============================================================ The following is my perl program: use strict; use DBI; my $dbh_target; $dbh_target = DBI->connect(&...

Error
Here is my code: <%@ Page CompilerOptions='/R:"C:\Program Files\Microsoft.NET\OracleClient.Net\System.Data.OracleClient.dll"' %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OracleClient" %> <%@ Import Namespace = "System.Web.UI" %> <script runat="server"> sub Page_Load dim myConnection as new OracleConnection("user id=intcor;password=pscor03;data source=hrprod.corp.int.digex.com;") dim myCommand as new OracleDataAdapter ("sele...

ORA-12154: TNS...
Hi! I'm preparing an application for the use of a new database. The current MySQL Database will be replaced by a Oracle Database. I'm trying to make the connection, but no success so far. I installed the Oracle Client software on my W2K machine, which is also running IIS and ASP.NET framework 1.1. A connection with the database on remote server MSR_LAMORAL can be made trough SQL Plus, TNSPING MSR_LAMORAL also works. However, when I try to connect trough my aspx page, I get this message: ORA-12154: TNS:kan opgegeven verbindings-ID niet herleiden (= Dutch, something like "...

The dbi-dev list
Just a gentle reminder... Please folks, don't cross-post to dbi-dev and dbi-users, or even post to dbi-dev at all, without good reason. The dbi-dev list is very low traffic (sometimes nothing at all for long periods :) but is intended only for the developers of DBD::* drivers and closely related modules. If it becomes heavy with questions from users then it'll have a negative impact on development. Thanks. Tim. I am trying to write something which opens this file called abstract.sql: select city, date from weather where temp_lo < ? and have it $sth->execu...

[perl5-dbi/DBI-Test] a2d1b2: create separate tests for DBI and DBI::Mock ...
----==_mimepart_51f946a54bb1b_2af891bd4c100430 Date: Wed, 31 Jul 2013 10:17:25 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <51f946a54c721_2af891bd4c100582@hookshot-fe3-pe1-prd.aws.github.net.mail> Branch: refs/heads/master Home: https://github.com/perl5-dbi/DBI-Test Commit: a2d1b22d134be0ca353e0f0b312fb14da24c798e https://github.com/perl5-dbi/DBI-Test/commit/a2d1b22d134be0ca353e0f0b312fb14da24c798e Author: Jens Rehsack <sno@netbsd.org> Date: 2013-07-31 (Wed, 31 Jul 2013) Changed ...

ORA-12154 COnnection Error
Hello I have a VB.NET application that was developed by someone else and I am working on fixing it. I think I am missing oracle drivers. When I run the application in Debug it fails and gives me ORA-12154 error TNS:Could not resolve service name. Can someone suggest where to look for what and such. This is the code where the error occurs. m_CachedConnection = New OleDbConnection m_CachedConnection.ConnectionString = "Provider=""ORAOLEDB.Oracle"";Database = ""PROD"";User ID=user;Data Source=""ECCWorld"";Passw...

ORA-03113 Error from DBI
Hi guys, I am trying to resolve a horrible error I am getting, and I really don't know where to start! I have created a Database link in Oracle and created a view to one of the tables in it. Now when I run the SQL statement, I get: ORA-03113: end-of-file on communication channel (DBD ERROR: OCIStmtExecute) I really have no idea where to begin on this one. Hope you can help Richard ============================================================================== This message is for the sole use of the intended recipient. If you received this message in error please dele...

ORA-12154 error msg
Hello all, Trying to use a TSQLConnection with Oracle 10g Express Edition, and I get a 12154 error message. I CAN connect to the database using TOAD. Particulars: Embarcadero RAD Studio XE running on a Windows 7 (64 bit) machine. I found something that suggested I add the following lines to sqlnet.ora, but alas it did not help: NAME.DEFAULT_ZONE = world NAMES.DEFAULT_DOMAIN = world NAMES.DIRECTORY_PATH=(ezconnect, tnsnames) Just for the hell of it I also installed MySQL to this machine and tried to connect using a TSQLConnection, but I got a similar error message. Any tip...

[perl5-dbi/dbi]
----==_mimepart_515e8f3785207_523740c1306299e Date: Fri, 05 Apr 2013 01:45:43 -0700 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-ID: <515e8f3787c27_523740c13063084@hookshot-fe5-pe1-prd.aws.github.net.mail> Branch: refs/heads/trunk Home: https://github.com/perl5-dbi/dbi ----==_mimepart_515e8f3785207_523740c1306299e-- ...

Web resources about - ORA-12154 - perl.dbi.dev

热门搜索 - 我的异常网
我的异常网之热门搜索专题提供权威的各类程序问题解决方案,欢迎您的到来。

Classic MetaLink vs. My Oracle Support
Jared Still's Ramblings Here you will find posts that are mostly about my work as an Oracle DBA. There may occasionally be other topics posted, ...

Resources last updated: 12/19/2015 10:16:48 AM