I have Oracle 9i 32bit version installed in my Windows 64bit machine. I am using Visual Studio 2010 / ASP.NET. When I try to establish a OracleConnection I am getting "ORA-12154: TNS:could not resolve service name." error. When I tnsping it's getting OK.
AND When I set my connection string as "Data Source=(DESCRIPTION=(CONNECT_DATA=(SID=TEST)(SERVICE_NAME=SOMETHING))(ADDRESS=(PROTOCOL=TCP)(HOST=SOMETHING)(PORT=MYPORT)))...
I
am getting the error "ORA-06413: Connection not open.". So I am really confused here with what is happening around.
Please, I am really appreaciating your all professional help. Thank you.
With that method of connecting, it requires you to have the tnsnames.ora file or it might give you grief. Take a look at this list of oracle connection alternatives as they may be easier to implement:
Everything is working perfectly in a Windows Application. But not in ASP.NET Web Application. So i guess there can't be anything wrong with tnsnames.ora file. Can it be some kind of permission issue?
I don't have a sqlnet.ora file in my admin directory. The thing that I can't understand is, why is it that I can't connect from ASP.NET and I can connect from Windows Application.
Because they are two different animals alltogether. But if you try some of the other connection strings shown in connectionstrings.com it should work. The other possibility is your web server is being blocked by a firewall. Have you asked your IT department
if they block connections to Oracle in any way?
jaliya.udage...
Member
2 Points
5 Posts
ORA-12154: TNS:could not resolve service name? - Oracle 9i 32bit version / Windows 64bit machine ...
Apr 17, 2012 04:14 PM|LINK
Hi Guys,
I have Oracle 9i 32bit version installed in my Windows 64bit machine. I am using Visual Studio 2010 / ASP.NET. When I try to establish a OracleConnection I am getting "ORA-12154: TNS:could not resolve service name." error. When I tnsping it's getting OK.
AND When I set my connection string as "Data Source=(DESCRIPTION=(CONNECT_DATA=(SID=TEST)(SERVICE_NAME=SOMETHING))(ADDRESS=(PROTOCOL=TCP)(HOST=SOMETHING)(PORT=MYPORT)))...
I am getting the error "ORA-06413: Connection not open.". So I am really confused here with what is happening around.
Please, I am really appreaciating your all professional help. Thank you.
Happy Coding.
Regards,
Jaliya
bbcompent1
All-Star
32992 Points
8508 Posts
Moderator
Re: ORA-12154: TNS:could not resolve service name? - Oracle 9i 32bit version / Windows 64bit mach...
Apr 17, 2012 04:37 PM|LINK
With that method of connecting, it requires you to have the tnsnames.ora file or it might give you grief. Take a look at this list of oracle connection alternatives as they may be easier to implement:
http://www.connectionstrings.com/oracle
jaliya.udage...
Member
2 Points
5 Posts
Re: ORA-12154: TNS:could not resolve service name? - Oracle 9i 32bit version / Windows 64bit mach...
Apr 17, 2012 04:57 PM|LINK
Hi Guys,
Everything is working perfectly in a Windows Application. But not in ASP.NET Web Application. So i guess there can't be anything wrong with tnsnames.ora file. Can it be some kind of permission issue?
bbcompent1
All-Star
32992 Points
8508 Posts
Moderator
Re: ORA-12154: TNS:could not resolve service name? - Oracle 9i 32bit version / Windows 64bit mach...
Apr 17, 2012 04:59 PM|LINK
I would suggest that you use the easy connection method like this:
Using the Easy Connect Naming Method (aka EZ Connect)
The easy connect naming method enables clients to connect to a database without any configuration.
<div id="p0cs4" class="cs_csbox">Data Source=username/password@//myserver:1521/my.service.com;</div> <div class="cs_bi">Port 1521 is used if no port number is specified in the connection string.
Make sure that EZCONNECT is enabled in the sqlnet.ora file. NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
'//' in data source is optional and is there to enable URL style hostname values
</div>jaliya.udage...
Member
2 Points
5 Posts
Re: ORA-12154: TNS:could not resolve service name? - Oracle 9i 32bit version / Windows 64bit mach...
Apr 18, 2012 03:28 AM|LINK
Hi bbcompent1,
I don't have a sqlnet.ora file in my admin directory. The thing that I can't understand is, why is it that I can't connect from ASP.NET and I can connect from Windows Application.
bbcompent1
All-Star
32992 Points
8508 Posts
Moderator
Re: ORA-12154: TNS:could not resolve service name? - Oracle 9i 32bit version / Windows 64bit mach...
Apr 18, 2012 12:06 PM|LINK
Because they are two different animals alltogether. But if you try some of the other connection strings shown in connectionstrings.com it should work. The other possibility is your web server is being blocked by a firewall. Have you asked your IT department if they block connections to Oracle in any way?