首页 > 数据库 >Oracle ODP.NET ConnectionString接池及连接参数

Oracle ODP.NET ConnectionString接池及连接参数

时间:2023-11-10 11:46:33浏览次数:41  
标签:ODP attribute ConnectionString 接池 connections connection pool Pool Size

 

 出自: https://blog.csdn.net/qq_28570965/article/details/126935639

 

1. 连接字符串中提供了服务器地址,端口,实例等信息,具体格式如下:
Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyDatasource)));
User ID=MyUserid;Password=MyPassword;Pooling=MyPooling; Min Pool Size=MyMinPoolSize; Max Pool Size=MyMaxPoolSize; Decr Pool Size=MyDecrPoolSize;Incr Pool Size=MyIncrPoolSize; Connect Timeout=MyConnectTimeout; Validate Connection=MyValidateConnection;

2. 主要节点信息
CONNECTION LIFETIME:连接池中CONNECTION的生命同期,当CONNECTION返回时验证
INCR POOL SIZE:连接池每次创建CONNECTION的数量
DECR POOL SIZE:连接池每次关闭CONNECTION的数量
MAX POOL SIZE:连接池中CONNECTION最大数量
MIN POOL SIZE:连接池中CONNECTION最小数量
USER ID:用户名
PASSWORD:用户密码
POOLING:启用连接池
CONNECTION TIMEOUT:建立物理连接的超时时间
CONNECT TIMEOUT:建立物理连接的超时时间
VALIDATE CONNECTION:验证当前CONNECTION是否有效

3. 如果不设置,ODP.NET提供以下默认值
Connection Lifetime = 0;
Incr Pool Size = 5;
Decr Pool Size = 1;
Max Pool Size = 100;
Min Pool Size = 1;
Pooling = true;
Connection Timeout = 15;
Connection Pool Timeout = 15;

4. 官方文档解释
Connection String Attribute Description Default Value
Application Continuity

Enables database requests to automatically replay transactional or non-transactional operations in a non-disruptive and rapid manner in the event of a severed database session, which results in a recoverable error.

Not Available in ODP.NET, Managed Driver and ODP.NET Core

true

Connection Lifetime

Minimum life time (in seconds) of the connection.

This attribute specifies the lifetime of the connection in seconds. Before the Connection is placed back into the pool upon a Close() or Dispose() call, the lifetime of the connection is checked. If the lifetime of the connection exceeds this property value and the number of connections will not fall below Min Pool Size, then the connection is destroyed. If this property value is 0, then the connection lifetime is never checked.

0

Connection Timeout

The time to wait (in seconds) for a new connection or an idle connection from the connection pool before a connection time out error can occur.

This attribute specifies the minimum amount of time (in seconds) that the Open() method must take to obtain a pooled connection before it terminates the request. This value comes into effect only if no free connection is available from the connection pool and the Max Pool Size is reached. If a free connection is not available within the specified time, an exception is thrown. Connection Timeout does not limit the time required to open new connections.

This attribute value takes effect for pooled connection requests and not for new connection requests.

(The default value is 0 for the implicit database connection in a .NET stored procedure.)

15

Context Connection

Returns an implicit database connection if set to true.

An implicit database connection can only be obtained from within a .NET stored procedure. Other connection string attributes cannot be used in conjunction with "context connection" when it is set to true.

Supported in a .NET stored procedure only

false

Data Source

Oracle Net Services Name, Connect Descriptor, or an easy connect naming that identifies the database to which to connect.

empty string

DBA Privilege

Administrative privileges.

This connection string attribute accepts SYSASM, SYSBACKUP, SYSDBA, SYSDG, SYSKM, SYSOPER, and SYSRAC as the attribute value. It is case-insensitive.

empty string

Decr Pool Size

Number of connections that are closed when an excessive amount of established connections are unused.

This connection string attribute controls the maximum number of unused connections that are closed when the pool regulator makes periodic checks. The regulator thread is spawned every 3 minutes and closes up to Decr Pool Size amount of pooled connections if they are not used. The pool regulator never takes the total number of connections below the Min Pool Size by closing pooled connections.

1

Enlist

Controls the enlistment behavior and capabilities of a connection in context of COM+ transactions or System.Transactions.

If this attribute is set to true, the connection is automatically enlisted in the thread's transaction context. If this attribute is false, no enlistments are made. If this attribute is set to dynamic, applications can dynamically enlist in distributed transactions. This attribute can be set to true, false, yes, no, or dynamic.

true

HA Events

Enables ODP.NET connection pool to proactively remove connections from the pool when an Oracle database service, service member, or node goes down.

This feature can be used with Global Data Services, including Oracle RAC, Data Guard, GoldenGate, and single instance deployments. "pooling=true" must also be set

This attribute can be set to true, false, yes, or no.

true

Load Balancing

Enables ODP.NET connection pool to balance work requests across Oracle database instances based on the load balancing advisory and service goal.

This feature can be used with Global Data Services, including Oracle RAC, Active Data Guard, and GoldenGate. "pooling=true" must also be set.

This attribute can be set to true, false, yes, or no.

true

Incr Pool Size

Number of new connections to be created when all connections in the pool are in use.

This connection string attribute determines the number of new connections that are established when a pooled connection is requested, but no unused connections are available and Max Pool Size is not reached. If new connections have been created for a pool, the regulator thread skips a cycle and does not have an opportunity to close any connections for 6 minutes. Note, however, that some connections can be still be closed during this time if their lifetime has been exceeded.

5

Max Pool Size

Maximum number of connections in a pool.

This attribute specifies the maximum number of connections allowed in the particular pool used by that OracleConnection. Simply changing this attribute in the connection string does not change the Max Pool Size restriction on a currently existing pool. Doing so simply creates a new pool with a different Max Pool Size restriction. This attribute must be set to a value greater than the Min Pool Size. This value is ignored unless Pooling is turned on.

100

Metadata Pooling

Caches metadata information.

This attribute indicates whether or not metadata information for executed queries are cached for improved performance.

True

Min Pool Size

Minimum number of connections in a pool.

This attribute specifies the minimum number of connections to be maintained by the pool during its entire lifetime. Simply changing this attribute in the connection string does not change the Min Pool Size restriction on a currently existing pool. Doing so simply creates a new pool with a different Min Pool Size restriction. This value is ignored unless Pooling is turned on.

1

Password

Password for the user specified by User Id.

This attribute specifies an Oracle user's password. Password is case-sensitive by default for Oracle Database 11g release 1 (11.1) and later.

empty string

Persist Security Info

Retrieval of the password in the connection string.

If this attribute is set to false, the Password value setting is not returned when the application requests the ConnectionString after the connection is successfully opened by the Open() method. This attribute can be set to either true, false, yes, or no.

false

Pooling

Connection pooling.

This attribute specifies whether or not connection pooling is to be used. Pools are created using an attribute value matching algorithm. This means that connection strings which only differ in the number of spaces in the connection string use the same pool. If two connection strings are identical except that one sets an attribute to a default value while the other does not set that attribute, both requests obtain connections from the same pool. This attribute can be set to either true, false, yes, or no.

true

Proxy User Id

User name of the proxy user.

This connection string attribute specifies the middle-tier user, or the proxy user, who establishes a connection on behalf of a client user specified by the User Id attribute. ODP.NET attempts to establish a proxy connection if either the Proxy User Id or the Proxy Password attribute is set to a non-empty string.

For the proxy user to connect to an Oracle database using operating system authentication, the Proxy User Id must be set to "/". The Proxy Password is ignored in this case. The User Id cannot be set to "/" when establishing proxy connections. The case of this attribute value is preserved.

empty string

Proxy Password

Password of the proxy user.

This connection string attribute specifies the password of the middle-tier user or the proxy user. This user establishes a connection on behalf of a client user specified by the User Id attribute. ODP.NET attempts to establish a proxy connection if either the Proxy User Id or the Proxy Password attribute is set to a non-empty string.

The case of this attribute value is preserved if it is surrounded by double quotes.

empty string

Statement Cache Purge

Statement cache purged when the connection goes back to the pool.

If statement caching is enabled, setting this attribute to true purges the Statement Cache when the connection goes back to the pool.

false

Statement Cache Size

Statement cache enabled and cache size set size, that is, the maximum number of statements that can be cached.

A value greater than zero enables statement caching and sets the cache size to itself. This value should not be greater than the value of the OPEN_CURSORS parameter set in the init.ora database configuration file.

0

Self Tuning

Enables or disables self-tuning for the connection.

If self-tuning is enabled, then the StatementCacheSize settings in the registry, configuration files, and connection string are ignored.

If self-tuning is disabled, then a StatementCacheSize value of 0 is used unless StatementCachSize is specified in the registry, configuration file, or connection string.

true

Tns_Admin

Directory where ODP.NET can find its sqlnet.ora and tnsnames.ora configuration files.

Not available in ODP.NET, Unmanaged Driver

empty string

Token_Auth

This attribute specifies the access token authentication type. Possible values are OCITOKEN, OAUTH, or DISABLED.

Only supported for managed ODP.NET and ODP.NET Core.

DISABLED

Token_Location

This attribute is the file-based token location. The value can be a directory where a file named "token" is or it can be the file's full path specification.

Only supported for managed ODP.NET and ODP.NET Core.

Varies depending on token authentication type

User Id

Oracle user name.

This attribute specifies the Oracle user name. The case of this attribute value is preserved if it is surrounded by double quotes. For the user to connect to an Oracle database using operating system authentication, set the User Id to "/". Any Password attribute setting is ignored in this case.

empty string

Validate Connection

Validation of connections coming from the pool.

Validation causes a round-trip to the database for each connection. Therefore, it should only be used when necessary.

false

Wallet_Location

ODP.NET wallet directory

Not available in ODP.NET, Unmanaged Driver

empty string
————————————————
版权声明:本文为CSDN博主「每天掉一根头发」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_28570965/article/details/126935639

标签:ODP,attribute,ConnectionString,接池,connections,connection,pool,Pool,Size
From: https://www.cnblogs.com/Jamesblog/p/17823728.html

相关文章

  • C3P0连接池详解及配置
    数据库连接是一个耗费大量资源且相当慢的操作,所以为了提高性能和连接速度,诞生了连接池这样的概念。在多用户并发操作过程中,连接池尤为重要。它是将那些已连接的数据库连接存放在一个容器里(连接池),这样以后别人要连接数据库的时候,将不会重新建立数据库连接(这样蜗牛的慢动作谁都受......
  • Spring+Druid连接池简单入门配置
    偶尔的机会解释Druid连接池,后起之秀,但是评价不错,另外由于是阿里淘宝使用过的所以还是蛮看好的。Druid集连接池,监控于一体整好复合当前项目的需要,项目是ssh结构,之前是用C3p0的,现在换一个连接池也是很简单的spring配置DataSource,配置如下:1.<beanid="dataSource"class="com.ali......
  • 第十章 数据库连接池与DBUtils工具
    目录一.单选题(共5题,50分)二.判断题(共5题,50分)一.单选题(共5题,50分)(单选题)已知,存在QueryRunner对象runner,SQL语句:Stringsql="select*fromuserwhereid=?";下面操作中,能实现查询指定记录的选项是()A.Useruser=(User)runner.query(sql,newBeanListHandler(User.c......
  • javaweb--数据库连接池
    数据库连接池是一个容器,负责分配、管理数据库连接(Connection)它允许应用程序重复使用一个现有的数据库连接,而不是重新建立一个;释放空闲时间超过最大空闲时间的数据库连接来避免因为没有释放数据库连接而引起的数据库连接遗漏好处:资源重用提升系统响应速度避免数据库连接遗漏......
  • The ConnectionString property has not been initialized.
     原因:情况1DbContext中没有指定连接字符串解决: 情况2appsettings.json配置文件的属性没有设置为始终复制 ......
  • C语言数据类型占用字节大小+modport存在的意义+传输延迟和惯性延迟+上下拉+forwarding
    C语言数据类型占用字节大小最大整形宽度是8字节。modport存在的意义似乎modport的存在没有意义了。只是将信号变得更冗长。但是又是有意义的,因为modport里的赋值变化是没有延迟的,而clocking受到配置的影响。https://blog.csdn.net/hh199203/article/details/127230498传输......
  • 数据库连接池
    //开启预编译功能Stringurl="jdbc:mysql://127.0.0.1:3306/db1?useSLL=false&useServerPrepStmts=true";盛connection的容器,标准接口:DataSource1.在lib目录下添加jar包,右击添加为库2.定义配置文件,放到src下3.加载配置文件Propertiseprop=newPropertise();prop......
  • 数据库连接池
    主要目的都是一样的包括套接字连接池避免频繁创建和销毁由来 客户端登录服务器去数据库查询这时就可以把服务器看做是数据库的客户端。一直保持和数据库的连接可以吗?可以但是需要服务器的一个线程来维持,又不做事。耗费资源一个数据库连接需要什么呢不仅少非自愿......
  • Mysql 连接池配置问题
     使用SglSugar BulkCopy方法进行大批量插入时一直报错,检查了实体、数据库字段属性都无异常,最后发现数据库连接中配置了 AllowZeroDatetime=true;ConvertZeroDateTime= true;注释后异常解决。  AllowZeroDatetime=true,可以解决的是Mysql中datetime默认值为0000-00......
  • redis普通连接和连接池, redis字符串类型,redis hash类型, redis列表类型
    1redis普通连接和连接池......