使用Windows身份验证与ODP.NET无法连接到Oracle [英] Can't connect to Oracle using Windows Authentication with ODP.NET

查看:437
本文介绍了使用Windows身份验证与ODP.NET无法连接到Oracle的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经配置了我的Oracle数据库NTS认证并设置我的Windows登录,像在数据库中的用户。

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

我能够登录到数据库的命令 sqlplus中/

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

我也能使用Windows身份验证使用System.Data.OracleClient的供应商ADO.NET连接。

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

例如,下面的code片段如下:

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();

不过,我无法使用Windows身份验证使用Oracle.DataAccess.Client(ODP.NET)来连接。

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();

的code会导致以下异常此块:

This block of code results in the following exception:

Oracle.DataAccess.Client.OracleException是未处理   消息= ORA-1017:无效的用户名/密码;登录否认

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

根据这个环节,我应该能够使用所提供的连接字符串创建一个ODP.NET连接到Oracle:的http://www.oracle.com/technetwork/articles/dotnet/cook-masteringdotnet-090821.html

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

为何ODP.NET客户端不会允许我连接而(德precated)微软客户端呢?

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

此问题在2007以下螺纹的讨论,但每次提供了无解:的 http://forums.oracle.com/forums/thread.jspa?messageID=2312148

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.

这是一个搅局者。

推荐答案

它工作正常使用ODP.net 11和该连接字符串(在Oracle客户端tnsnames.ora文件来定义DLGP)我:数据源= DLGP;用户ID = /;密码=;

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=;

您sqnet.ora文件需要正确设置这个工作,但是这应该已经是如果的SQLPlus可以连接的情况。你只有一个Oracle主?如果ODP.net是捡了第二个,可事情搞砸的时候很好的(而且可以根据你如何安装它发生)。

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).

这篇关于使用Windows身份验证与ODP.NET无法连接到Oracle的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆