1

I've configured my Oracle Database for NTS Authentication and set my Windows Login up as a user in the database.

I'm able to log in to the Database with the command sqlplus /.

I'm also able to connect using Windows Authentication using the System.Data.OracleClient provider for ADO.NET.

For example, the following code snippet works:

DbProviderFactory factory = DbProviderFactories.GetFactory("System.Data.OracleClient");
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = "Data Source=//localhost/Test; Integrated Security=yes";
connection.Open();

However, I'm unable to connect using Windows Authentication using Oracle.DataAccess.Client (ODP.NET).

DbProviderFactory factory = DbProviderFactories.GetFactory("Oracle.DataAccess.Client");
DbConnection connection = factory.CreateConnection();
connection.ConnectionString = "Data Source=//localhost/Test; User Id=/";
connection.Open();

This block of code results in the following exception:

Oracle.DataAccess.Client.OracleException was unhandled Message=ORA-1017: invalid username/password; logon denied

According to this link I should be able to create an ODP.NET connection to Oracle using the provided connection string: http://www.oracle.com/technetwork/articles/dotnet/cook-masteringdotnet-090821.html

Why does the ODP.NET client not allow me to connect while the (deprecated) Microsoft client does?

This problem was discussed at the following thread in 2007, but no solution was every provided: http://forums.oracle.com/forums/thread.jspa?messageID=2312148.

This is a showstopper.

1 Answer 1

3

It works fine for me using ODP.net 11 and this connection string (with a tnsnames.ora file in the Oracle client to define DLGP): Data Source=DLGP;User Id=/;Password=;

Your sqnet.ora file needs to be setup correctly for this to work, but that should already be the case if SQLPlus can connect. Do you only have one Oracle home? If ODP.net is picking up a second one that can muck things up nicely (and that can happen depending on how you install it).

Sign up to request clarification or add additional context in comments.

2 Comments

You're right, the ODP client was installed in it's own Oracle Home which did not have the requisite sqlnet.ora containing the all important SQLNET.AUTHENTICATION_SERVICES = (NTS) line (I use ezconnect not tnsnames.ora). I'm now using the xcopy deployment hack found at bit.ly/mUxVhh and placing the sqlnet.ora in the same directory as the dll's, seems to work nicely! Thanks, I'm going to accept this answer now.
Alternately, you can put a SQLNET.AUTHENTICATION_SERVICES entry in your application.config file (or machine.config): (docs.oracle.com/cd/E47955_01/win.121/e41125/…)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.