Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Oracle.ManagedDataAccess.Core 23.4.0 causes ORA-00303: syntax error in NV string and I can't connect to my Oracle Instance

Stefano D'OnofrioJun 20 2024 — edited Jun 20 2024

As per title Oracle.ManagedDataAccess.Core 23.4.0 causes ORA-00303: syntax error in NV string when opening a connection to the Oracle Instance .

Digging a bit into it we found that is because I have my windows account contains an aphostrofe in it.

More specifically when in the AddressResolution constructor you are using NVFactory to generate a NVPair, you parse a tnsAddress passed as parameter. If in the tnsAddress there is an aphostrofe, it will throw a OracleInternal.Network.NetworkException ORA-00303: syntax error in NV string exception. I think we need to downgrade to the previous version (3.21.140) for now because we think the library is unusable by anyone having the aphostrope in the Host Account but would be amazing if you can fix it.

Comments

Alex Keh-Oracle Jun 20 2024

Are you using Windows authentication to connect to the Oracle DB? Does this use Active Directory or any other configuration of note?

Can you share sample code that reproduces the error with an example of the username that has the problem?

Stefano D'Onofrio Jun 20 2024 — edited on Jun 20 2024

I'm not using Windows Auth to connect to the Oracle DB but I think is taking that parameter to construct the tnsAddress.

The code I'm running is the following:

var commandText = "SELECT VERSION_FULL FROM PRODUCT_COMPONENT_VERSION"; 
using var con = new OracleConnection("User Id=system;Password=password;Data Source=localhost:1521/FREE;"); 
con.Open(); // is throwing exception here
var cmd = con.CreateCommand(); 
cmd.CommandText = commandText;

where on localhost I'm running an official docker container for Version 23 (from here) without any additional configuration.

Alex Keh-Oracle Jun 20 2024 — edited on Jun 20 2024

Thanks for the sample. You're using Easy Connect for the connect string Data Source.

We usually see this type of error when there's a problem in the connect descriptor or net service name format.

Can you share what part of your Windows account that has an apostrophe? If you don't want to share the exact account name for security reasons, you can share an example of what this Windows account would look like to reproduce this error.

When you said “Windows account”, I thought you may be using Windows auth, but perhaps you mean your machine name has an apostrophe.

Update:

After doing some more research, ODP.NET can use some ODP.NET Windows username for internal purposes. Knowing the Windows username would be useful.

Stefano D'Onofrio Jun 21 2024

So, my TnsAddress is

(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=FREE)(CID=(PROGRAM=C:\Repos\OracleConnectionTest\OracleConnectionTest\bin\Debug\net8.0\OracleConnectionTest.dll)(HOST=MyMachine)(USER=Stefano.D'Onofrio))))

I believe that the User part (from Environment.Username) is the one that makes the following code to throw an exception in NVTokens.Parse method

if (nvString[index] == '\'' || nvString[index] == '"')
  throw new NetworkException(303);

Here you are throwing the exception if the nvString (constructed from the tnsAddress) contains the aphostrope character

Alex Keh-Oracle Jun 21 2024

Thanks, Stefano! I've filed bug 36759038 to have one of our ODP.NET engineers review the test case and fix the bug.

Stefano D'Onofrio Jun 24 2024

Thanks Alex. Is there a place where I can find the status of this bug?

Alex Keh-Oracle Jun 24 2024

Hi Stefano,

You can log into Oracle My Oracle Support (MOS) and find Oracle published bugs there. If you don't have a MOS account, your DBA can check or grant you an account.

ozkan pakdil Sep 18 2024 — edited on Sep 18 2024

Hi @alex-keh-oracle I am checking the bug report, but I do not understand if this is solved or not, can you say ?

I also check multiple versions on https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core#versions-body-tab one by one but could not find 36759038 in their release notes.

Thank you

Alex Keh-Oracle Sep 18 2024

Status 11 means the bug has not been fixed. If fixing this issue is critical for your organization in the near term, you can request support to increase the Dev Priority of the bug. That will place it higher up in the bug fix queue.

1 - 9

Post Details

Added on Jun 20 2024
9 comments
486 views