ORA-12504: TNS listener was not given the SERVICE_NAME in CONNECT_DATA (3 Merged) [message #525686] |
Tue, 04 October 2011 11:25 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/ce816a920a78566d008316e55ec7b32e?s=64&d=mm&r=g) |
sowmya1388
Messages: 5 Registered: October 2011
|
Junior Member |
|
|
I am trying to connect to Oracle 11g using ODBC.
I created a data source name from Admistrative Tools->ODBC Data Sources.I selected Oracle in OraClient11g_home1 as the driver. I tested the connection and it was succesful.
I tried to connect from visual studio. I used the Data Source as Microsoft ODBC Data SOurce. Selected my DSN from drop down (LORAC). I gave the user name and password and got the followign errors:
ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
This is my tnsnames.ora located in C:\oracle\product\11.1.0\client_1\network\admin directory.
# tnsnames.ora Network Configuration File: C:\oracle\product\11.1.0\client_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
LORAC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = lorac.chem.tamu.edu)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = lorac.chem.tamu.edu)
)
)
STOCKROOM2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = lorac.chem.tamu.edu)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = lorac.chem.tamu.edu)
)
)
When i do tnsping LORAC, i get OK. When I do tnsping of the other service name i get Failed. However when I try to connect to that service from Visual studio I get a differnt set of errors:
ORA-12154: TNS:could not resolve the connect identifier specified
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
I had assumed that as the test connection from ODBC Administrator had worked I would be able to connec to my database from viusal studio. Is there something wrong in my tnsnames.ora? The content or its directory location?
ANy help wpuld be greatly appreciated
|
|
|
|
|
|
Re: ORA-12504: TNS listener was not given the SERVICE_NAME in CONNECT_DATA [message #525919 is a reply to message #525821] |
Thu, 06 October 2011 20:26 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/ce816a920a78566d008316e55ec7b32e?s=64&d=mm&r=g) |
sowmya1388
Messages: 5 Registered: October 2011
|
Junior Member |
|
|
Yes I believe the tnsping was issued from server system.
I am trying to connect to a database hosted on a different system. I was given the following information by the Database Administrator:
Database Hostname: Lorac.chem.tamu.edu
Database Instance: Stockroom2
Username/Password: Inventory_mgmt/invmgmt
Oracle 11g Express Edition is installed in the system.
This is a brand new system and as far as I know SQL *Net has never been used till this application.
Here are the results of lsnrctl status and lsnrctl service commands:
C:\oraclexe\app\oracle\product\11.2.0\server>lsnrctl status
LSNRCTL for 32-bit Windows: Version 11.2.0.2.0 - Production on 06-OCT-2011 20:17
:01
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for 32-bit Windows: Version 11.2.0.2.0 - Produ
ction
Start Date 05-OCT-2011 14:57:23
Uptime 1 days 5 hr. 19 min. 39 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Default Service XE
Listener Parameter File C:\oraclexe\app\oracle\product\11.2.0\server\network\a
dmin\listener.ora
Listener Log File C:\oraclexe\app\oracle\diag\tnslsnr\Programmer2-PC\lis
tener\alert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Programmer2-PC)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=Programmer2-PC)(PORT=8080))(Presenta
tion=HTTP)(Session=RAW))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
The command completed successfully
C:\oraclexe\app\oracle\product\11.2.0\server>lsnrctl service
LSNRCTL for 32-bit Windows: Version 11.2.0.2.0 - Production on 06-OCT-2011 20:17
:19
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "XEXDB" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: PROGRAMMER2-PC, pid: 2852>
(ADDRESS=(PROTOCOL=tcp)(HOST=Programmer2-PC)(PORT=49164))
Service "xe" has 1 instance(s).
Instance "xe", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully
|
|
|
|
|
|
|