Oracle ManagedDataAccess - 连接请求超时 - 池化
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30955745/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Oracle ManagedDataAccess - Connection Request Timed out - Pooling
提问by Ruth Amui
I'm finally admitting defeat and asking for help. I've done everything I can think of to solve this problem, but it seems I'm incapable of doing it.
我终于承认失败并寻求帮助。我已经做了我能想到的一切来解决这个问题,但似乎我无能为力。
I'm working with: VS2010 C# Oracle 12c ODP.Net Managed121012
我正在使用:VS2010 C# Oracle 12c ODP.Net Managed121012
I have inherited an app that uses both the managed and unmanaged dataaccess dll. It was working until I de-installed oracle. I then re-installed the 11g client for a 64bit machine. Right away I noticed that there was only dataaccess dll for framework 2 installed, but I continued anyway. I then copied all the oci and ora dlls from the client_1 folder into the bin directory of my app as well as the Oracle.DataAccess.dll into my bin directory too. I also copied Oracle.ManagedDataAccess.dll into this folder.
我继承了一个同时使用托管和非托管数据访问 dll 的应用程序。在我卸载 oracle 之前它一直在工作。然后我为 64 位机器重新安装了 11g 客户端。我马上注意到只有用于框架 2 的 dataaccess dll 安装,但我还是继续了。然后,我将 client_1 文件夹中的所有 oci 和 ora dll 复制到我的应用程序的 bin 目录中,并将 Oracle.DataAccess.dll 也复制到我的 bin 目录中。我还将 Oracle.ManagedDataAccess.dll 复制到此文件夹中。
My application ran successfully as long as I didn't change anything on my datasets. I would have happily carried on like this, except I have to create more datasets. When I tried to add a new dataset, my data source connection wizard drop down list was blank. Then I tried to re-create the connections, but could only see the .Net Framework DProviders. I could not see the managed provider. At some point I also got this error "no data provider is currently selected".
只要我没有更改数据集上的任何内容,我的应用程序就会成功运行。我会很高兴地继续这样下去,除非我必须创建更多的数据集。当我尝试添加新数据集时,我的数据源连接向导下拉列表是空白的。然后我尝试重新创建连接,但只能看到 .Net Framework DProviders。我看不到托管提供程序。在某些时候,我也收到了这个错误“当前没有选择数据提供者”。
Thinking it's because the managed provider wasn't installed I uninstalled the 11g client and installed the 64bit 12c client and copied all the relevant files into the bin of my app. I added the following lines to my app.config file:
认为这是因为没有安装托管提供程序我卸载了 11g 客户端并安装了 64 位 12c 客户端并将所有相关文件复制到我的应用程序的 bin 中。我在 app.config 文件中添加了以下几行:
<configSections>
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess" />
<system.data>
<DbProviderFactories>
<remove invariant="Oracle.DataAccess.Client" />
<remove invariant="Oracle.ManagedDataAccess.Client" />
<add name="ODP.NET, Managed Driver" invariant="Oracle.DataAccess.Client"
description="Oracle Data Provider for .NET, Managed Driver"
type="Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.121.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
</DbProviderFactories>
After this I can now see some of the old data sources, but I can't connect to my database because I get a "Connection Request Timed out". When I manually creating a new connection, I can connect fine with the unmanaged provider, but get a connection request timed out error.
在此之后,我现在可以看到一些旧的数据源,但我无法连接到我的数据库,因为我收到“连接请求超时”。当我手动创建新连接时,我可以与非托管提供程序正常连接,但出现连接请求超时错误。
I'm really at the end of my rope and would really appreciate fresh eyes before I use the rope.
我真的在我的绳索的尽头,并且在我使用绳索之前真的很感激新鲜的眼睛。
Thanks in advance.
提前致谢。
回答by tomekole
I had identical problem after switching to managed driver. Even wrote a test app using both native and managed drivers. The conclusion was that the managed driver needs much more time to open new connection than the native driver. A solution that worked for us was to set a large connection timeout using connection string.
切换到托管驱动程序后,我遇到了同样的问题。甚至使用本机和托管驱动程序编写了一个测试应用程序。结论是托管驱动程序需要比本地驱动程序更多的时间来打开新连接。对我们有用的解决方案是使用连接字符串设置大的连接超时。
<connectionStrings>
<add name="ConnectionString" connectionString="data source=xxxx;user id=xxxx;password=xxxx;persist security info=false;Connection Timeout=120;" />
</connectionStrings>