Problem Connecting to Oracle from .NET3.5 application

Hello,
I have a NET3.5 web application which is trying to connect to a Oracle10g Db.
The connection string is as follows:
<add key="connectionstring2" value="Driver={Microsoft ODBC for Oracle};Server=Test;Uid=Test1;Pwd=Gold;"/>
Iam using the System DSN to connect to.
But I get the following exception when I try to open a connection.
+            ex      {"ERROR [08001] [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:could not resolve the connect identifier specified\r\nERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed\r\nERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr)."}      System.Exception {System.Data.Odbc.OdbcException}

Any Inputs highly appreciated.
Thanks.
Star79Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

strickddCommented:
Sounds like you are either specifying the wrong drive in the connection string or you have the wrong driver installed.
0
Star79Author Commented:
Can you please be more specific.
Thanks.
0
Star79Author Commented:
I have given the correct drive name and also the odbc driver is installed too
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

mrjoltcolaCommented:
This is an Oracle error, so you have the correct driver, but your client is not configured right. Verify your tnsnames.ora, sample below.

Use tnsping to see if the service works from Oracle without .NET

# Replace CAT with your database instance name
# Replace the ip address with your server's ip address
# Save to {ORACLE_HOME}/network/admin/tnsnames.ora
# Then verify with:  tnsping CAT
# And:  sqlplus scott/tiger@CAT            <-- change scott/tiger to a valid user/pass
CAT =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.5)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = CAT)
    )
  )

Open in new window

0
schwertnerCommented:
You have to pay attention to the following components:

1. Host name of Oracle server
2. Protocol used for connection
3. Port used
4. Service name of the Oracle instance

Set these parameters very carefully.

Additionaly ensure that there are not fiorewalls and antiviruses between.
Be aware that the port mentioned is used only to initiate connection.
After that it will be changed to other.
So the other port should not be blocked.
0
Star79Author Commented:
Iam able to connect to the DB through the tool SQL Developer..
Dont see a possibility of error in the tnsnames.ora file
0
schwertnerCommented:
SQLDeveloper doesn't use Oracle client and TNSNAMES.ORA file at all.
It uses jdbc connection.
Check ALL tnsnames.ora files for relevance.
0
Star79Author Commented:
checked all the tnsnames.ora files everything seems to be good...
Any inputs will help a lot..
Thanks
0
schwertnerCommented:
returning to the roots and to the message " The driver doesn't support the version of ODBC behavior that the application requested "
it seems ID:24842828Author:strickddDate:07/13/09 10:08 PM
is correct.
Possibly you have to use the Oracle driver (available on OTN) or to search on Microsoft site for further notes. Of course I can also do this, but I your experience will bring more.
0
Star79Author Commented:
Hello All,
Just an update on the error Iam getting currently.

ex      {"ORA-12154: TNS:could not resolve the connect identifier specified\n"}      System.Data.OracleClient.OracleException

The connection string used is MS ODBC for oracle and is below:
  <add key="connectionstring3" value="Password=GoldGold*1;User ID=AMDB;Data Source=AMDB_LOCAL;"/>


Any help appreciated a lot...
Thanks.
0
mrjoltcolaCommented:
I do not see that you ever tried tnsping <SERVICE> where service is the alias in your tnsnames.ora
0
schwertnerCommented:
I do not see the connection details

You have to pay attention to the following components:

1. Host name of Oracle server
2. Protocol used for connection
3. Port used
4. Service name of the Oracle instance

Set these parameters very carefully.

These seems not to be enough:

Server=Test;Uid=Test1;Pwd=Gold;"/>

0
Star79Author Commented:
I tried the tnsping and it returned back with 'service is running"
Thanks.
0
schwertnerCommented:
You do not provide the needed parameters for the connection.

Also issue on the server

lsnrctl services

to see the services
0
Star79Author Commented:
The below is the entry in my tnsnames.ora file against which Iam connecting:
AMDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = Testserver)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = AMDB)
    )
  )
I tried the tnsping AMDB(if Iam correct) and it returned back with "failed to resolve name"
Thanks for any input....this has been eating my days !!!!
0
schwertnerCommented:
This means that you have more then one Oracle product on the machine.
Find ALL tnsnames.ora files and see which is the correct.
Also if you have Net MAnager (Oracle product in Oracle run )
see if the test on this entry is successful or not.
all firewalls - off. Antiviruses - off.
0
Star79Author Commented:
Just an update...the issue resolved with changing the sqlnet file with the param
"EZCONNECT"
Thanks.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Applications

From novice to tech pro — start learning today.