0

我遇到了一个问题,Oracle.ManagedDataAccess即似乎不可能使用非 ASCII 连接字符串(非 ASCII 只是经验猜测)。

这一切都很好,花花公子:

var cs = string.Format("Data Source={2};Password={1};User ID={0}", "user", "pwd", "mydb");
var connection = new OracleConnection(cs);
connection.Open();

但这不起作用(å、ä 和 ö 是瑞典字母):

var cs = string.Format("Data Source={2};Password={1};User ID={0}", "åäö", "lösenord", "mydb");
var connection = new OracleConnection(cs);
connection.Open();

并抛出

Oracle.ManagedDataAccess.Client.OracleException: ORA-01017: invalid username/password; logon denied

两个用户都能够通过 sqldeveloper 登录。

有谁知道解决这个问题的方法?或者这是Oracle的ManagedDataAccess(嗯, )库的一个已知限制?DataAccess

Ninja 的东西,即喜欢使用Chr(int),在登录时很难做到。

数据库信息:

NLS_LANGUAGE    AMERICAN
NLS_TERRITORY   AMERICA
NLS_CURRENCY    $
NLS_ISO_CURRENCY    AMERICA
NLS_NUMERIC_CHARACTERS  .,
NLS_CHARACTERSET    WE8MSWIN1252
NLS_CALENDAR    GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE   AMERICAN
NLS_SORT    BINARY
NLS_TIME_FORMAT HH.MI.SSXFF AM
NLS_TIMESTAMP_FORMAT    DD-MON-RR HH.MI.SSXFF AM
NLS_TIME_TZ_FORMAT  HH.MI.SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
NLS_DUAL_CURRENCY   $
NLS_COMP    BINARY
NLS_LENGTH_SEMANTICS    BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET  AL16UTF16
NLS_RDBMS_VERSION   11.2.0.1.0

编辑:

还对此进行了测试(即添加引号,就像OracleConnectionStringbuilder“=”一样):

var cs = string.Format("Data Source={2};Password={1};User ID={0}", "\"åäö\"", "\"lösenord\"", "mydb");
var connection = new OracleConnection(cs);
connection.Open();
4

2 回答 2

1

I just ran into the same problem and this issue got fixed with the latest ODP Managed Driver version from September 16, 2016 (4.121.2.20150926).

Be careful to download it from the 32bit section of the Oracle website (http://www.oracle.com/technetwork/database/windows/downloads/utilsoft-087491.html) as Oracle seems to have missed to also add it to the 64 bit section, where the latest version is still from October 2015. For more information see also my question on the Oracle forums: https://community.oracle.com/message/14037653#14037653

Makes you kinda wonder though what Oracle is up to, since they did not support language specific characters for 3 years in their managed driver...

于 2016-09-23T07:01:56.667 回答
0

I had a problem with special characters (ex. "=") inside my username. I solved this problem with OracleConnectionStringBuilder. There must be some kind of encoding which it does. Try this, I hope it helps with your problem too.

OracleConnectionStringBuilder connBuilder = new OracleConnectionStringBuilder();
connBuilder.DataSource = "mydb";
connBuilder.UserID = "åäö";
connBuilder.Password = "lösenord";

var connection = new OracleConnection(connBuilder.ToString());
connection.Open();
于 2013-08-19T11:07:48.640 回答