最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

.net - Unexpected Additional Calls to Oracle Server During Application Shutdown Using oci.dll (oci21) – How to Prevent This? - S

programmeradmin1浏览0评论

I have a simple application using oci.dll (Oracle.DataAccess and Oracle Instant Client) with the following code:

Console.WriteLine($"Connection create...");
using (var connection = new OracleConnection())
{
    var osb = new OracleConnectionStringBuilder()
    {
        UserID = "user",
        Password = "<password>",
        DataSource = "database",
        Pooling = false,
    };
    connection.ConnectionString = osb.ConnectionString;
    Console.WriteLine($"Connection open...");
    connection.Open();
    try
    {
        Console.WriteLine($"Command create...");
        using (var cmd = connection.CreateCommand())
        {
            cmd.CommandText = "select 1 from dual";
            Console.WriteLine($"Command open...");
            using (var reader = cmd.ExecuteReader())
            {
                Console.WriteLine($"Reader open...");
                reader.Read();
                var count = reader.GetDecimal(0);
                Console.WriteLine($"DUAL: {count}");
            }
        }
    }
    finally
    {
        Console.WriteLine($"Connection close...");
        connection.Close();
    }
}
Console.WriteLine($"Done...");

After the application completes (when "Done..." is printed), additional calls to the server occur during the shutdown of the application. Tracing using Oracle trace files reveals the following functions are being executed:

  • OpsDecFreeValCtx()
  • OpsConFreeValCtx()
  • OpsConOpen()
  • And further communication via OCIServerAttach() and OCISessionBegin().

This behavior does not occur with oci18, but it happens consistently with oci21.

Question: How can I prevent these additional calls during application shutdown? Are there specific configurations or workarounds for oci21 that would stop this behavior?

Any insights or suggestions are greatly appreciated. Thanks in advance!

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论