注册

连接字符串的schema含有特殊字符时无法连接成功

懒懒想睡觉 2024/06/15 497 7

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】: dm8_single:dm8_20230808_rev197096_x86_rh6_64
【操作系统】:docker
【CPU】: Intel Xeon E6520
【问题描述】*:
连接字符串中的Schema含有"."时无法正常访问。不含"."时正常。

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="dmdbms.DmProvider" Version="1.1.0.20739" />
</ItemGroup>

</Project>

DmConnection cnn = new DmConnection();
try
{
// cnn.ConnectionString = "server=127.0.0.1:30236; user=SYSDBA; password=SYSDBA001; Schema=XX.YY";
// cnn.ConnectionString = "server=127.0.0.1:30236; user=SYSDBA; password=SYSDBA001; Schema='XX.YY'";
// cnn.ConnectionString = "server=127.0.0.1:30236; user=SYSDBA; password=SYSDBA001; Schema="XX.YY"";
cnn.ConnectionString = "server=127.0.0.1:30236; user=SYSDBA; password=SYSDBA001; Schema=Test";
cnn.Open();

DmCommand command = new DmCommand();
command.Connection = cnn;

command.CommandText = "SELECT Id FROM SomeTable;";
DmDataReader reader = (DmDataReader)command.ExecuteReader();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}

cnn.Close();

回答 0
暂无回答
扫一扫
联系客服