Re: OCCI connect vs. sqlplus

From: Shane <gshanemiller_at_verizon.net>
Date: Thu, 30 Apr 2009 15:01:24 -0700 (PDT)
Message-ID: <af1119a0-5f3e-44c2-a4b2-8a3bc4cc516b_at_b6g2000pre.googlegroups.com>



On Apr 30, 4:38 pm, Shane <gshanemil..._at_verizon.net> wrote:
> On Apr 30, 4:14 pm, sybra..._at_hccnet.nl wrote:
>
>
>
>
>
> > On Thu, 30 Apr 2009 12:43:39 -0700 (PDT), Shane
>
> > <gshanemil..._at_verizon.net> wrote:
> > >On Apr 2, 1:31 am, usenet2..._at_zacek.de (Viktor Zacek) wrote:
> > >> Shane <gshanemil..._at_verizon.net> wrote:
> > >> > But connecting to the same db from the same box with thisOCCIC++:
> > >> > gives
> > >> >    ORA-01017: invalid username/password; logon denied
>
> > >> Different ORACLE_HOME and therefore different tnsnames.ora?
>
> > >> I don't know the way the C++ interface works, but hat this trivial case
> > >> sometimes on notebooks.
> > >> After renaming/moving databases, some of our notebooks where not able to
> > >>connect, because for some ORACLE_HOME they had a local tnsnames.ora and
> > >> not the central one.
>
> > >> Simple thing, sometimes hard to find ;-)
>
> > >> Best regards,
> > >> Viktor
>
> > >I am at my wits end on this. And the DBAs here are no help at all.
>
> > >this command works great:
> > >$sqlplussmiller/mill_at_oradev
>
> > >A OTL program with theconnectstring "smiller/mill_at_oradev" connected
> > >the first time I wrote and every time after that. Easy.
>
> > >$tnsping oradev gives:
> > >TNS Ping Utility for Solaris: Version 10.2.0.3.0 - Production on 30-
> > >APR-2009 15:37:12
>
> > >Copyright (c) 1997, 2006, Oracle.  All rights reserved.
>
> > >Used parameter files:
>
> > >Used TNSNAMES adapter to resolve the alias
> > >Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS =
> > >(PROTOCOL = TCP)(HOST = sundev16)(PORT = 28538))) (CONNECT_DATA =
> > >(SERVICE_NAME = oradev.bloomberg.com)))
> > >OK (30 msec)
>
> > >So it seems like aOCCIprogram which attempts toconnectand
> > >disconnect ala:
>
> > >        env = Environment::createEnvironment();
> > >        conn = env->createConnection("smiller","mill99","oradev");
> > >        Environment::terminateEnvironment(env);
>
> > >would work. but instead I get "database exception occurred: ORA-01017:
> > >invalid username/password; logon denied". If I do this too many times
> > >my account will be locked.
>
> > >If I change conn line to:
>
> > >        conn = env->createConnection
> > >("smiller","mill99","sundev16:28538");
>
> > >I now get "database exception occurred: ORA-12514: TNS:listener does
> > >not currently know of service requested inconnectdescriptor" and,
> > >weirdly, a file sqlnet.log is left in my CWD and it reads:
>
> > >***********************************************************************
> > >Fatal NIconnecterror 12514, connecting to:
> > > (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=sundev16.bloomberg.com)(CID=
> > >(PROGRAM=yagorcldb.sundev1.tsk)(HOST=sundev18)(USER=smiller)))(ADDRESS=
> > >(PROTOCOL=TCP)(HOST=172.17.5.23)(PORT=28538)))
>
> > >  VERSION INFORMATION:
> > >        TNS for Solaris: Version 10.2.0.3.0 - Production
> > >        TCP/IP NT Protocol Adapter for Solaris: Version 10.2.0.3.0 -
> > >Production
> > >  Time: 30-APR-2009 15:41:47
> > >  Tracing not turned on.
> > >  Tns error struct:
> > >    ns main err code: 12564
> > >    TNS-12564: TNS:connection refused
> > >    ns secondary err code: 0
> > >    nt main err code: 0
> > >    nt secondary err code: 0
> > >    nt OS err code: 0
>
> > >I cannot help but feeling that some network or .ora file is not setup
> > >right.
>
> > >I've been trying to fix this on and off for over 3 weeks.
>
> > UsingOCCI, you are using a *different* password, aren't you?
> > (mill99 instead of mill)
> > And I don't thinkOCCIsupports the EZCONNECT method (you'll get 12514
> > if your service name is NOT in tnsnames.ora).
> > Actually this looks like a typical case of NOT reading documentation
> > to me (and maybe a shortage of coffee and a problem of eyesight)
>
> > --
> > Sybrand Bakker
> > Senior Oracle DBA- Hide quoted text -
>
> > - Show quoted text -
>
> Apologies for confusion: the correct password is ``mill99" i.e.:
> $ alias sp
> alias sp='sqlplus smiller/mill99_at_oradev'
> $ sp
>
> SQL*Plus: Release 10.2.0.3.0 - Production on Thu Apr 30 16:32:29 2009
>
> Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.
>
> Connected to:
> Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit
> Production
> With the Partitioning, OLAP and Data Mining options
>
> SQL> show user
> USER is "SMILLER"
> SQL>
>
> The Oracle OCCI doc here:http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14294/relati...
> This like most examples doesn't discuss limitations of the EZ method
> and doesn't use a connection string.- Hide quoted text -
>
> - Show quoted text -

As Mr. Bakker suggested, this may be how one connects. A working OCI program here was revised
to use my login and it appears to work. That code calls (rougly)

  • OCIEnvCreate
  • OCIHandleAlloc 3 times
  • OCIServerAttach
  • OCIAttrSet & more OCIHandleAlloc calls
  • OCISessionBegin
  • OCIAttrSet

The OTL code does much the same thing b/c it's based on OCI.

Meanwhile, I cannot find a documented, buildable example which connects to the db via the non-EZ method. I have looked on the Oracle documentation site; will have to look harder.

Shane Received on Thu Apr 30 2009 - 17:01:24 CDT

Original text of this message