Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id E5ABB1337B4E for ; Wed, 11 May 2011 00:35:16 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 25044-02 for ; Wed, 11 May 2011 03:35:09 +0000 (UTC) X-Greylist: delayed 00:25:41.322669 by SQLgrey-1.7.6 Received: from intasect.com.cn (unknown [202.98.123.179]) by mail.postgresql.org (Postfix) with ESMTP id 153561337B83 for ; Wed, 11 May 2011 00:35:07 -0300 (ADT) Received: from lhb3 [222.209.225.106] by intasect.com.cn with ESMTP (SMTPD32-8.12) id ADD62304C2; Wed, 11 May 2011 11:09:10 +0800 Message-ID: From: =?gb2312?B?wO68dLH4?= To: "Robert Haas" Cc: References: <201104260936.p3Q9aZTP029148@wwwmaster.postgresql.org> Subject: Re: BUG #5994: Can't excute DBI->connect to oracle by client site Date: Wed, 11 May 2011 11:09:08 +0800 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="gb2312"; reply-type=original Content-Transfer-Encoding: 8bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6090 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.668 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RDNS_NONE=0.793, STOX_REPLY_TYPE=0.439 X-Spam-Level: X-Archive-Number: 201105/76 X-Sequence-Number: 30215 I run my test program with 2 ways in the same login environment.One succeed and one fail. 1) psql -d dbi_link_test -->connect succeed 2) psql -h HOSTNAME -d dbi_link_test -->connect fail The different is connection options(Unix Domain Sockets/TCP Sockets). ----- Original Message ----- From: "Robert Haas" To: "Li Hongbing" Cc: Sent: Tuesday, May 10, 2011 10:40 AM Subject: Re: [BUGS] BUG #5994: Can't excute DBI->connect to oracle by client site On Tue, Apr 26, 2011 at 5:36 AM, Li Hongbing wrote: > I am trying to create a 64-bit postgresql 8.4 database server which can > retrieve data from Oracle(10gR2) at an other server by DBI-LINK. > > DBI-LINK works good on postgresql server site when I connect to linux by > telnet.When I connect to postgresql server by postgresql client just like > pgAdmin or EMS SQL Manager,I got a error like this: > error from Perl function "set_up_connection": DBI > connect('host=192.168.138.173;sid=smmacs;port=1521','rmtrsys',...) failed: > ORA-24327: need explicit attach before authenticating a user (DBD ERROR: > OCISessionBegin) at line 43 at line 35. > > so I write test code to confirm DBI connect function > > CREATE OR REPLACE FUNCTION dbi_link.test2() > RETURNS char AS > $BODY$ > use DBI; > use DBD::Oracle; > > > my $dbname = 'xxx'; > my $user = 'rmtrsys'; > my $passwd = 'rmtrsys'; > > my $dbh = > DBI->connect("dbi:Oracle:host=192.168.138.173;sid=smmacs;port=1521", $user, > $passwd,{ora_charset => 'UTF8'}) or > die "Database connection not made: $DBI::errstr"; > > $dbh -> disconnect; > > return "OK"; > > $BODY$ > LANGUAGE 'plperlu' VOLATILE > COST 100; > > > When I connect to linux by telnet and excute psql -d dbi_link_test to run,it > works good > > dbi_link_test=# select dbi_link.test2(); > test2 > ------- > OK > (1 row) > > But when I connect by postgresql client (pgAdmin or EMS SQL Manager) to run > same sql, it returned an error: > NOTICE: DBI > connect('host=192.168.138.173;sid=smmacs;port=1521','rmtrsys',...) failed: > ORA-24327: need explicit attach before authenticating a user (DBD ERROR: > OCISessionBegin) at line 10 > > > ERROR: error from Perl function "test2": Database connection not made: > ORA-24327: need explicit attach before authenticating a user (DBD ERROR: > OCISessionBegin) at line 10. > > ********** ¥¨¥é©` ********** > > ERROR: error from Perl function "test2": Database connection not made: > ORA-24327: need explicit attach before authenticating a user (DBD ERROR: > OCISessionBegin) at line 10. > SQL¥¹¥Æ©`¥È:XX000 > > > when got this error,I can't shutdown the server normally,ths shutdown > command will not terminate unless I cancel it. > [postgres@localhost ~]$ pg_ctl stop -D /usr/local/pgsql/data > waiting for server to shut down...LOG: received smart shutdown request > .LOG: autovacuum launcher shutting down > .......................... > > Above test let me know the DBI-LINK crushed by DBI->connect, I think the > really reason is one of these: > 1.postgresql create backend process has a bug,most likely with bad process > environment var > 2.Orace OCI functions has a bug > 3.DBD:Oracle has a bug > > However,I should report this as a postgresql bug ,becourse of run same sql > must get same result anywhere(server or client). My guess is that, depending on how you connect, something in your environment is different, and that is what is making the Oracle connection succeed or fail. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs