java 如何在jdbc中使用oracle数据库中的连接池?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7399331/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 19:47:44  来源:igfitidea点击:

How to use connection pool in jdbc with oracle database?

javadatabaseconnection-poolingapache-commons-dbcp

提问by MemoryLeak

I am using jdbc to write a java desktop application, and this application will connect to oracle database.
is the DBCP library still work ? How can I configure a datasource in java desktop application ? is there any sample code for this ?
Thanks in advance !

我正在使用 jdbc 编写一个 java 桌面应用程序,这个应用程序将连接到 oracle 数据库。
DBCP 库还有效吗?如何在 Java 桌面应用程序中配置数据源?是否有任何示例代码?
提前致谢 !

回答by a_horse_with_no_name

You can use the connection pool that is built into the Oracle driver. So you don't need to have a dependency to a 3rd party library.

您可以使用内置于 Oracle 驱动程序中的连接池。所以你不需要依赖于 3rd 方库。

For details see the JDBC Programmer's Guide it contains examples as well:

有关详细信息,请参阅 JDBC 程序员指南,其中还包含示例:

http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/concache.htm#CDEGABII

http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/concache.htm#CDEGABII