Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: TNS could not resolve the connect identifier
antonyliu2002_at_yahoo.com wrote:
> hpuxrac wrote:
> > antonyliu2002_at_yahoo.com wrote:
> > > The backend database for my web application is Oracle 10.1.0.2.0.
> > >
> > > This database resides on Machine A.
> > > The Web server is running on Machine B.
> > > I am developing the web application on Machine C.
> > >
> > > >From within Visual Web Developer 2005 Express on Machine C, I
> > > successfully configured the database connection. So, from the
> > > development machine, the web application works great, and the ListBox
> > > gets populated with data from the Oracle database nicely.
> > >
> > > But, if I check out this web application from the web sever on Machine
> > > B, I get the following error:
> > >
> > > <error>
> > > System.Data.OleDb.OleDbException: ORA-12154: TNS:could not resolve the
> > > connect identifier specified.
> > > </error>
> > >
> > > And the following the portion for connectionString in web.config for
> > > this web application:
> > >
> > > <connectionStrings>
> > > <add name="MyOracleConnectionString"
> > > connectionString="Provider=MSDAORA.1;Data Source=MyDataSource;Persist
> > > Security Info=True;Password=MyPassword;User ID=MyUserID"
> > > providerName="System.Data.OleDb" />
> > > </connectionStrings>
> > >
> > > I can tnsping mydatabase with no problem on both the development
> > > machine (Machine C) and the productive web server (Machine B). So, I
> > > guess this issue is probably not related to the TNSNAME setting.
> > >
> > > Is it because the same database provider is not installed on the
> > > productive web server (Machine B)? Would you kindly share your wisdom
> > > please? Thanks.
> >
> > Using tnsping is not as good as using a real connection such as via
> > command line sqlplus from both machines. Can you connect into the
> > database from the production web server via dos level utilities?
> >
> > Your guess about the database provider may be a good one. Many of us
> > here that hang out on cdos don't spend a lot of time with microsoft
> > software ( for various reasons ).
> >
> > Who is responsible for the support and administration of the production
> > web server? If I were you I would work with them.
> >
> > It's also possible that there are some firewall related settings that
> > don't allow traffic between the machines on the ports necessary. I
> > have been at places where it takes several months to work through a
> > security audit and change request to allow this kind of traffic.
>
>
>
>
>
>
>
>
>
SQLPLus cannot connect to the 10g database either, and you are
receiving unable to resolve TNS name errors? Did you install the
Oracle InstantClient, or did you perform a Custom install of the Oracle
client (note that this is terminology that appears in the 10g R2
client, it may be slightly different in the 10g R1 client)? I suggest
that you perform a custom install and make certain that you specify
"Oracle Objects for OLE" and "Oracle ODBC Driver". Once the correct
drivers are installed, verify that the TNSNAMES.ORA file is correctly
configured for the database connection. On my system, this file is
found in the folder:
C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN
The connection details in the TNSNAMES.ORA file may look like this:
MYSID =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = SERVER_NAME_HERE)(PORT =
1521))
)
(CONNECT_DATA =
(SERVICE_NAME = MYSID) (SID = MYSID)
If the TNSNAMES.ORA file were set up like the above (and your server
had an instance named MYSID), you should be able to connect to the
database by opening a command prompt, and typing the following (after
the >):
C:> SQLPLUS /NOLOG
SQL> CONNECT MyUserID/MyPassword_at_MYSID
The above command will likely fail if MyUserID is the SYS user. If the above does not work, start checking the system for problems. Is the computer finding the TNSNAMES.ORA file that you just checked? There is a free utility named FileMon (the development company was recently bought out by Microsoft) that will tell you exactly which files the client is attempting to access when connecting to the database. If you see no problems - all of the right files are being accessed, try specifying the server's IP address in the TNSNAMES.ORA file, rather than the server name. That IP address would be entered in this section "HOST = SERVER_NAME_HERE". If that solves the problem, it could be that there is a DNS/WINS name resolution problem on your network (I have to do this for client connecting remotely by VPN, or set up a HOSTS file entry for the server name).
If you continue having problems, analyze the network traffic with a packet sniffer - the open source Ethereal (now called WireShark) works very well for this. This will tell you significant information about what the computer is sending over the network and what the responses to those packets are - if you find that the computer is correctly sending packets (may be identified as TNS in the packet capture) to the server, but never receives a response, that may indicate that a firewall is blocking the packets, or that a non-standard "PORT =" is specified on the server or client (TNSNAMES.ORA on the client, LISTENER.ORA on the server). If you find that the client is trying to resolve a name such as MYSID.mydomain.com by DNS rather than by looking in the TNSNAMES.ORA file, that implies a configuration problem on the client that should be resolved by searching the Registry for "LOCAL".
Once SQLPLus is able to connect, a connection string like what I originally sent should be able to connect to the database.
Good luck with the problem.
Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc.
Received on Thu Nov 23 2006 - 08:20:57 CST
![]() |
![]() |