From: asger.grunnet on
Hello,

I have made an ASP.NET application that connects to an Oracle database
through ODBC. When I run the application in my development environment,
it works fine, but when I run it in the customers test-environment, I
get the following ODBC error message:

ERROR [08001] [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154:
TNS:could not resolve service name
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's
SQLSetConnectAttr failed

I have googled for this error, and it seems to be a very common Oracle
problem - usually caused by a missing clause in the tnsnames.ora file.
I don't think the tnsnames.ora file has anything to do with the error I
experience, though. Mostly because the error does not occur the first
time the application accesses the database. The first SQL I send seems
to work fine - at least it does not result in an error - but the second
SQL returns the error above (both are very simple SELECT statements).

I tried sending the exact same SQLs from a desktop application using
the same ODBC connection, and they worked fine, so it must be the
combination of Oracle and ASP.NET that gives the error.

In my development environment I run Oracle 8.1, and the customer runs
Oracle 9.2. Could that make a difference?

Could the error message actually cover for another error, such as
insufficient rights to the tables or a missing field in a table? Except
if that was the case, then the desktop application should have
experienced the same problem.

Unfortunately, I do not have the possibility of debugging in the
test-environment - not that that would help me much; I already know
where the error occurs in the code.

I have absolutely no idea what the problem could be - I hope that
someone can give me a hint, or just something that I could try...

Regards,
Asger

From: Brian Peasland on
> ERROR [08001] [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154:
> TNS:could not resolve service name
> ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's
> SQLSetConnectAttr failed
>
> I have googled for this error, and it seems to be a very common Oracle
> problem - usually caused by a missing clause in the tnsnames.ora file.
> I don't think the tnsnames.ora file has anything to do with the error I
> experience, though. Mostly because the error does not occur the first
> time the application accesses the database. The first SQL I send seems
> to work fine - at least it does not result in an error - but the second
> SQL returns the error above (both are very simple SELECT statements).

First, please use Oracle's ODBC driver. Microsoft's ODBC driver is very
flaky when it comes to actually connecting and interacting with an
Oracle database. I think Microsoft created this driver for the sole
purpose of getting customers to use SQL Server instead, but I have no
proof. ;)

Second, you will have to put the "missing clause" in your tnsnames.ora
configuration file.


HTH,
Brian


--
===================================================================

Brian Peasland
dba(a)nospam.peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown
From: asger.grunnet on

Brian Peasland wrote:
> > ERROR [08001] [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154:
> > TNS:could not resolve service name
> > ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's
> > SQLSetConnectAttr failed
> >
> > I have googled for this error, and it seems to be a very common Oracle
> > problem - usually caused by a missing clause in the tnsnames.ora file.
> > I don't think the tnsnames.ora file has anything to do with the error I
> > experience, though. Mostly because the error does not occur the first
> > time the application accesses the database. The first SQL I send seems
> > to work fine - at least it does not result in an error - but the second
> > SQL returns the error above (both are very simple SELECT statements).
>
> First, please use Oracle's ODBC driver. Microsoft's ODBC driver is very
> flaky when it comes to actually connecting and interacting with an
> Oracle database. I think Microsoft created this driver for the sole
> purpose of getting customers to use SQL Server instead, but I have no
> proof. ;)

Thank you very much for answering!

I can try to use Oracle's driver, but I don't think it will make any
difference -
mostly because the SQLs work fine when I send them using the desktop
application (as opposed to the ASP.NET application). The desktop app
uses
the exact same ODBC connection as the web application does.

Anyway, tomorrow I am going to visit the customers IT-department, so I
have an opportunity to try some things myself, rather than having it
done
by email - they do not allow any kind of remote access to their
servers.
I will definitely try to change the ODBC driver. I would be surprised -
but
also very happy - if that was all there was to it.

> Second, you will have to put the "missing clause" in your tnsnames.ora
> configuration file.

I will definitely try that as well. But if that was the problem, then I
don't
understand how the first SQL sent by the application works ok, whereas
the second one fails? That just doesn't make any sense to me.

Regards,
Asger

From: Sybrand Bakker on
On 24 Sep 2006 13:39:14 -0700, asger.grunnet(a)gmail.com wrote:

>
>I will definitely try that as well. But if that was the problem, then I
>don't
>understand how the first SQL sent by the application works ok, whereas
>the second one fails? That just doesn't make any sense to me.

2 possibilties

a (most likely) somehow there is a database link involved in the
second sql statement
b the two statements go to different data sources.

As far as I know (but nothing is certain anymore when M$ comes into
play) the scenario you describe is simply impossible, or the database
server has problems with conflicting server and client versions.

--
Sybrand Bakker, Senior Oracle DBA
 | 
Pages: 1
Prev: Urgent help needed!
Next: ORA-13249