English 中文(简体)
我如何为使用Fill方法学执行储存程序的OracleDataAdapter设定连接寿命?
原标题:How can I set a connection lifespan timeout for an OracleDataAdapter executing a stored procedure using the Fill Method?

我有点。 NET代码,利用ADO检索Oracle仓库程序的结果。 NET 图书馆,并将结果分为以下数据表:

using System.Data.OracleClient;

public DataTable getData()
{
    OracleConnection conn = new OracleConnection("Data Source=DATASOURCE;Persist Security Info=True;User ID=userID;Password=userPass;Unicode=True;Min Pool Size=1;Max Pool Size=20;Connection Lifetime=300");
    DataTable dt = new DataTable();
    conn.Open();
    try
    {
       OracleCommand oraCmd = new OracleCommand();
       oraCmd.Connection = conn;
       oraCmd.CommandText = "stored_procedure.function_name";
       oraCmd.CommandType = CommandType.StoredProcedure;
       oraCmd.Parameters.Add("cursor", OracleType.Cursor).Direction = ParameterDirection.Output;
       OracleDataAdapter oraAdapter = new OracleDataAdapter(oraCmd);
       oraAdapter.Fill(dt);
    }
    finally
    {
       conn.Close();
       return dt;
    }
}

该法典一直在针对我执行该法典的若干项目开展工作,没有任何问题。 然而,我正在讨论一个新项目的问题,在这个新项目中,Oracle DB机器实际上比作反应要慢得多,在太多客户开始使用硬件时,似乎反应不灵。 我想做的是,在阿达普特实施某种时间选择。 先令指挥——因为数据库似乎反应不灵,所以。 该网络的应用将持续十分钟或十分钟以上,永远不会达到最后的编码锁,关闭亚洲开发银行的联系。

我所处的环境仅限于利用MSDN图书馆与Oracle数据库连接,因此我希望我能够利用ADO。 NET Control。

最佳回答

突击性财产不使用该系统。 数据:OracleClient .NET 3.5 供应商。 似乎没有使用外部图书馆,这种功能似乎得不到支持。

问题回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签