"ORA--12154 TNS:could not resolve service name" ONLY at Runtime.

In Design Time the TOracleSession Component access the database, I can explore the tables it works well. But in runtime the TOracleSession doesn't connect to the Oracle, it raises an Exception
 
If you enable SQL*Net tracing you should be able to find out what goes wrong. Have you already tried this?
 
Yes I tried. But I can't understand what's happening. I'll send you the trace files. The first one and the second are when I open the Delphi project. The other is when I run the application.

(I'll send the files in different posts)
 
This is the file "sessions.log_448.trc" when delphi opens the project.

--- TRACE CONFIGURATION INFORMATION FOLLOWS ---
New trace stream is c:\temp\Oracletrace\sessions.log_448.trc
New trace level is 4
--- TRACE CONFIGURATION INFORMATION ENDS ---

--- PARAMETER SOURCE INFORMATION FOLLOWS ---
Attempted load of system pfile source C:\oracle\ora90\network\admin\sqlnet.ora
Parameter source loaded successfully

Attempted load of local pfile source C:\User\jar\Emerius\aplicacoes\pesquisa\Pesquisa Totalv24_3\sqlnet.ora
Parameter source loaded successfully

-> PARAMETER TABLE LOAD RESULTS FOLLOW PARAMETER TABLE HAS THE FOLLOWING CONTENTS
 
In this files I hade to change some Parenthesis for {} in order to post the message.

This is the file "sessions.log_448_1.trc" when delphi opens the project.

--- TRACE CONFIGURATION INFORMATION FOLLOWS ---
New trace stream is c:\temp\Oracletrace\sessions.log_448_1.trc
New trace level is 4
--- TRACE CONFIGURATION INFORMATION ENDS ---

--- PARAMETER SOURCE INFORMATION FOLLOWS ---
Attempted load of system pfile source C:\oracle\ora90\network\admin\sqlnet.ora
Parameter source loaded successfully

Attempted load of local pfile source C:\User\jar\Emerius\aplicacoes\pesquisa\Pesquisa Totalv24_3\sqlnet.ora
Parameter source loaded successfully

-> PARAMETER TABLE LOAD RESULTS FOLLOW PARAMETER TABLE HAS THE FOLLOWING CONTENTS nsinfflg[0]: 0x1 inf->nsinfflg[1]: 0x1
nsopen: global context check-in (to slot 0) complete
nscon: doing connect handshake...
nscon: sending NSPTCN packet
nscon: got NSPTRD packet
nscall: redirected
nstimarmed: no timer allocated
nsclose: closing transport
nsclose: global context check-out (from slot 0) complete
nscall: connecting...
nttgetport: port resolved to 1037
nttbnd2addr: using host IP address: 10.33.1.9
nsopen: opening transport...
nttcnp: Validnode Table IN use; err 0x0
nttcni: trying to connect to socket 596.
nttcon: set TCP_NODELAY on 596
nsopen: transport is open
nsnainit: inf->nsinfflg[0]: 0x1 inf->nsinfflg[1]: 0x1
nsopen: global context check-in (to slot 0) complete
nscon: doing connect handshake...
nscon: sending NSPTCN packet
nscon: got NSPTAC packet
nscon: doing connect handshake...
nscon: nsctxinf[0]=0x61, [1]=0x1
nsnainconn: inf->nsinfflg[0]: 0x61 inf->nsinfflg[1]: 0x1
nsnasend: bytes to send: 133
nsdo: 133 bytes to NS buffer
nsnareceive: buffer address: 0x129400 bytes wanted: 2048
nsnareceive: calling NS to receive 2048 bytes into address 0x129400
nsdo: 117 bytes from NS buffer
nsnareceive: received 117 bytes
nsnareceive: no more data to receive - returning
nsnareceive: total bytes received: 117
nigini: Count in NI global area now: 2
nigini: Count in NI global area now: 2
nncpmlf_make_local_addrfile: local names file is C:\User\jar\Emerius\aplicacoes\pesquisa\Pesquisa Totalv24_3\tnsnames.ora
nncpmsf_make_sys_addrfile: system names file is C:\oracle\ora90\network\admin\tnsnames.ora
nigtrm: Count in the NI global area is now 1
nigtrm: Count in the NL global area is now 1
nigini: Count in NI global area now: 2
nigini: Count in NI global area now: 2
niotns: niotns: setting up interrupt handler...
niotns: Not trying to enable dead connection detection.
niotns: Calling address:
(DESCRIPTION=
(ADDRESS_LIST=
(ADDRESS=
(PROTOCOL=TCP)(HOST=10.33.11.1)(PORT=1521)
)
)
(CONNECT_DATA=
(SID=sinus)
(CID=
(PROGRAM=C:\Programas\Borland\Delphi5\Bin\Delphi32.exe)
(HOST=E2KT)
(USER=dwhouse))
)
)
nscall: connecting...
nttgetport: port resolved to 1521
nttbnd2addr: using host IP address: 10.33.11.1
nsopen: opening transport...
nttcnp: Validnode Table IN use; err 0x0
nttcni: trying to connect to socket 624.
nttcon: set TCP_NODELAY on 624
nsopen: transport is open
nsnainit: inf->nsinfflg[0]: 0x1 inf->nsinfflg[1]: 0x1
nsopen: global context check-in (to slot 0) complete
nscon: doing connect handshake...
nscon: sending NSPTCN packet
nscon: got NSPTRS packet
nscon: sending NSPTCN packet
nscon: got NSPTAC packet
nscon: doing connect handshake...
nscon: nsctxinf[0]=0x1, [1]=0x1
nsnainconn: inf->nsinfflg[0]: 0x1 inf->nsinfflg[1]: 0x1
nsnasend: bytes to send: 83
nsdo: 83 bytes to NS buffer
nsnareceive: buffer address: 0x1295b0 bytes wanted: 2048
nsnareceive: calling NS to receive 2048 bytes into address 0x1295b0
nsdo: 77 bytes from NS buffer
nsnareceive: received 77 bytes
nsnareceive: no more data to receive - returning
nsnareceive: total bytes received: 77
nioqbr: state = normal (0)
nsdo: sending NSPTMK packet
nioqrs: state = interrupted (1)
nsdo: sending NSPTMK packet
nsrdr: got NSPTMK packet
nserror: nsres: id=0, op=70, ns=12582, ns2=0; nt[0]=0, nt[1]=0, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
nserror: nsres: id=0, op=70, ns=12630, ns2=0; nt[0]=0, nt[1]=0, nt[2]=0; ora[0]=0, ora[1]=0, ora[2]=0
 
When I run the application these trace files are created.

FILE "sessions.log_1808.trc"

--- TRACE CONFIGURATION INFORMATION FOLLOWS ---
New trace stream is c:\temp\Oracletrace\sessions.log_1808.trc
New trace level is 4
--- TRACE CONFIGURATION INFORMATION ENDS ---

--- PARAMETER SOURCE INFORMATION FOLLOWS ---
Attempted load of system pfile source C:\oracle\ora90\network\admin\sqlnet.ora
Parameter source loaded successfully

Attempted load of local pfile source C:\User\jar\Emerius\aplicacoes\pesquisa\Pesquisa Totalv24_3\sqlnet.ora
Parameter source loaded successfully

-> PARAMETER TABLE LOAD RESULTS FOLLOW PARAMETER TABLE HAS THE FOLLOWING CONTENTS PARAMETER TABLE LOAD RESULTS FOLLOW PARAMETER TABLE HAS THE FOLLOWING CONTENTS
 
We have the same problem with version 4.0.7.1 for DOA.

The first login is fine, then we use the same DB name/user/password to do a second login - but this login fails!

Any solution to this problem?
 
We found the reason for our problem.

Our customar had the tnsnames.ora stored in the directory where the EXE file (using DOA) was started from. A new component that where just implemented, was activated after the initial login. This new component changed current directory and because of this no tnsnames.ora file could be found.

/Cheers
 
Back
Top