更新时间:2023-09-21 08:47:58
有关池的唯一原因就是性能,因此,如果您夜间作业它的窗口内运行,没有什么不对的你在做什么,特别是因为它让你实现通过简单不必担心死连接。
不过,我不会让这种标准的做法。我很少写code处理陈旧的连接,即使在当时它是一个简单的工厂。这个问题与你们为什么都失效连接开始?通常,这涉及任一防火墙或DBA工作终止空闲连接,这两者应该改变或松弛为应用程序的帐户。即使在这种情况下,你可以做到以下几点:
更多信息可以在这里找到: http://docs.oracle.com/cd/E15296_01/doc.111/e15167/featConnecting.htm#i1006228
I am writing a nightly job to move data from SQL Server to Oracle using ODP.NET.
We use around 100 connection objects(independent of data) and we don't expect more than 1500 rows to transfer in a single run(in total). The ODP.NET notes and materials I read never talk about keeping connection pooling off.
In dev, I keep the connection pooling off and it just works fine.
Is it advisable in the given scenario to keep the connection pooling off,(given all the connections are disposed properly after use)since:
It is a nightly job and there wont be much load on the Oracle server.
Connection Pooling might return stale connections, for which validate settings/exception handing needs to be done.
The only reason for pooling is performance, so if your nightly job runs within it's window, there's nothing wrong with what you are doing, especially since it keeps your implementation simple by not having to worry about dead connections.
That said, I wouldn't make this standard practice. I rarely write code to handle stale connections and even then it's a simple factory. The question starts with why do you have stale connections at all? Typically this relates to either a firewall or a DBA job terminating idle connections, both of which should be changed or relaxed for an application account. Even in that case you can do the following:
More info can be found here: http://docs.oracle.com/cd/E15296_01/doc.111/e15167/featConnecting.htm#i1006228