Oracle Data Provider for .NET

C# – 处理 Oracle Data Provider for .NET 连接超时问题 在处理连接请求超时时,我们可以检查网络连接是否正常,并确保数据库服务器正常运行。在使用 Oracle Data Provider for .NET 连接到数据库之前,我们可以通过设置连接字符串中的 “Connection Timeout” 属性来指定连接超时时间。连接超时是指在尝试与数据库建立连接时,连接请求等待的时间超过了预设的超时时间。请注意,连接超时时间应根据实际情况进行调整,以确保在连接建立期间有足够的时间来完成连接。在处理连接请求超时时,我们可以使用异步连接方法来提高应用程序的响应性能。 阅读详情
Oracle Data Provider for .NET
AuthorDate Of SubmissionUser Level
Rama Mohan G. 02/20/2004Intermediate

Features of Oracle Data Provider for .NET
Oracle Data Provider for .NET provider-specific features and how to use them to develop .NET applications.
Connecting to the Oracle Database Server
This section describes OracleConnection provider-specific features.
Connection String Attributes
Table 3.1 lists the supported connection string attributes.
Table 3-1 Supported Connection String Attributes  
Connection String Attribute
Default value
Description
Connection Lifetime
0
Maximum life time (in seconds) of the connection
Connection Timeout
15
Maximum time (in seconds) to wait for a free connection from the pool
Data Source
empty string
Oracle Net Service Name that identifies the database to connect to
DBA Privilege
empty string
Administrative privileges: SYSDBA or SYSOPER
Decr Pool Size
1
Controls the number of connections that are closed when an excessive amount of established connections are unused
Enlist
true
Enables or disables serviced components to automatically enlist in distributed transactions
Incr Pool Size
5
Controls the number of connections that are established when all the connections in the pool are used
Max Pool Size
100
Maximum number of connections in a pool
Min Pool Size
1
Minimum number of connections in a pool
Password
empty string
Password for the user specified by User Id
Persist Security Info
false
Enables or disables the retrieval of password in the connection string
Pooling
true
Enables or disables connection pooling
Proxy User Id
empty string
User name of the proxy user
Proxy Password
empty string
Password of the proxy user
User Id
empty string
Oracle user name

The following example uses connection string attributes to connect to an Oracle database server:
// C#
...
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=scott;Password=tiger;Data Source=oracle;";
con.Open();
...
 
Connection Pooling
ODP.NET connection pooling is enabled and disabled using the Pooling connection string attribute. By default, connection pooling is enabled. The following are ConnectionString attributes that control the behavior of the connection pooling service:
?Pooling
?Connection Lifetime
?Connection Timeout
?Max Pool Size
?Min Pool Size
?Incr Pool Size
?Decr Pool Size
Connection Pooling Example
The following code opens a connection using ConnectionString attributes related to connection pooling.
// C#
...
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=scott;Password=tiger;Data Source=oracle;" +
"Min Pool Size=10;Connection Lifetime=120;Connection Timeout=60;" +
"Incr Pool Size=5; Decr Pool Size=2";
con.Open();
...

With connection pooling enabled (the default), the Open and Close methods of the OracleConnection object implicitly use the connection pooling service. In the preceding code, the Open call uses the connection pooling service, which is responsible for returning a connection to the application.
Connection pools are created by the connection pooling service using the ConnectionString as a signature to uniquely identify a pool.
If no pool with the exact attribute values in the ConnectionString exists, the connection pooling service creates a new connection pool. If a pool already exists with the requested signature, a connection is returned to the application from that pool.
When a connection pool is created, the connection-pooling service initially creates the number of connections defined by the Min Pool Size attribute of the ConnectionString. This number of connections is always maintained by the connection pooling service for the connection pool.
At any given time, these connections are available in the pool or used by the application.
The Incr Pool Size attribute of the ConnectionString defines the number of new connections to be created by the connection pooling service when more connections are needed in the connection pool.
When the application closes a connection, the connection pooling service determines whether the connection lifetime has exceeded the Connection Lifetime attribute; if so, the connection pooling service closes the connection; otherwise, the connection goes back to the connection pool. The connection pooling service only enforces the Connection Lifetime when a connection is going back to the connection pool.
The Max Pool Size attribute of the ConnectionString sets the maximum number of connections for a connection pool. If a new connection is requested, no connections are available, and Max Pool Size has been reached, then the connection pooling service waits for the time defined by Connection Timeout. If the Connection Timeout has been reached and there are still no connections available in the pool, the connection pooling service raises an exception indicating that the pooled connection request has timed-out.
The connection pooling service closes connections when they are not used; connections are closed every three minutes. The Decr Pool Size attribute of the ConnectionString provides connection pooling service for the maximum number of connections that can be closed in one run.
Operating System Authentication
The Oracle database server can use Windows user login credentials to authenticate database users. To open a connection using Windows user login credentials, the User Id ConnectionString attribute must be set to /. If Password is provided, it is ignored.
// C#
...
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=/;Data Source=oracle;";
con.Open();
...
Privileged Connections
Oracle allows database administrators to connect to an Oracle database server with either SYSDBA or SYSOPER privileges. This is done through the DBA Privilege attribute of the ConnectionString.
The following example connects SYS/SYS as SYSDBA:
// C#
...
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=SYS;Password=SYS;" +
"DBA Privilege=SYSDBA;Data Source=oracle;";
con.Open();
...
Password Expiration
Oracle allows users' password to expire. ODP.NET lets applications handle the password expiration by providing a new method, OpenWithNewPassword, that opens the connection with a new password.
The following code snippet uses the OracleConnection OpenWithNewPassword method to connect with a new password of panther:
// C#
...
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=scott;Password=tiger;Data Source=oracle;";
// Here the con.Open() fails if the password has expired.
// An application catches this and attempts to reconnect with a new password
// of "panther". The initial connection string must remain intact.

try {
con.Open();
}
catch {
con.OpenWithNewPassword("panther");
}
...
 
Proxy Authentication
Oracle allows a middle-tier server to connect to proxy clients in a secure fashion.
In multitier environments, proxy authentication allows control of middle-tier application security by preserving client identities and privileges through all tiers, and by auditing actions taken on behalf of clients. The proxy authentication feature allows the identity of a user using a Web application to be passed through the application to the database server.
ODP.NET supports proxy authentication with or without a client password by providing the Proxy User Id and Proxy Password attributes of the ConnectionString property.
// C#
...
OracleConnection con = new OracleConnection();
// Connecting using proxy authentication
con.ConnectionString = "User Id=customer;Password=lion;" +
"Data Source=oracle;Proxy User Id=appserver;Proxy Password=eagle; ";
con.Open();
...

Transparent Application Failover (TAF) Callback Support
Transparent Application Failover(TAF) is a feature in Oracle that provides high availability.
TAF enables an application connection to automatically reconnect to a database if the connection fails. Active transactions roll back, but the new database connection, made by way of a different node, is identical to the original. This is true regardless of how the connection fails.
With Transparent Application Failover, a client notices no loss of connection as long as there is one instance left serving the application. The database administrator controls which applications run on which instances and also creates a failover order for each application.
Given the delays that failovers can cause, applications may wish to be notified by a TAF callback. ODP.NET supports TAF callback through the Failover event of the OracleConnection object, which allows applications to be notified whenever a failover occurs. To receive TAF callbacks, an event handler function must be registered with the Failover event.
When a failover occurs, the Failover event is raised and the registered event handler is invoked several times during the course of reestablishing the connection to another Oracle instance.
The first call to the event handler occurs when the Oracle Database first detects an instance connection loss. This allows the application to act accordingly for the upcoming delay for the failover.
If the failover is successful, the Failover event is raised again when the connection is reestablished and usable. At this time, the application can resynchronize the OracleGlobalization session setting and inform the application user that a failover has occurred.
If failover is unsuccessful, the Failover event is raised to inform the application that a failover did not take place.
The application can determine whether or not the failover is successful by checking the OracleFailoverEventArgs that is passed to the event handler.
The following code example registers an event handler method called OnFailover:

// C#
...
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=scott;Password=tiger;Data Source=oracle;";
con.Open();
con.Failover += new OracleFailoverEventHandler(OnFailover);
...

The Failover event only invokes one event handler. If multiple Failover event handlers are registered with the Failover event, only the event handler registered last is invoked.
Oracle Data Provider for .NET安装实战指南 Oracle Data Provider for .NET (ODP.NET) 是Oracle官方提供的.NET环境下的数据访问解决方案,用于连接Oracle数据库并执行数据操作。作为一种高性能的数据库连接机制,ODP.NET支持丰富的数据库功能和特性,诸如PL/SQL块执行、存储过程调用、大对象(LOB)处理、以及XML数据类型操作等。在ODP.NET中,连接对象是用于与Oracle数据库建立物理连接的实例。连接对象在使用完毕后不应直接释放,而应该放回到连接池中,以便后续重用。 阅读详情

相关推荐

Oracle Data Provider for .NET 2.0 (2.111.6.20)

Oracle Data Provider for .NET 2.0 (2.111.6.20)asp.net 2.0 Membership提供程序

OracleConnection ,OracleCommand 数据库连接执行

//官网帮助连接 OracleCommand 类帮助官网 一、下面的示例使用的 ExecuteReader 方法 OracleCommand OracleDataReader 和和 OracleConnection ,从表中选择行。 public void ReadMyData(string connectionString) { string queryString = "SELECT EmpNo, DeptNo FROM Scott.Emp"; using (OracleConnecti

YIMI的博客 2510

5G NR协议栈及功能1 - 总体架构与物理层

  备注:本文所有图片均来自3GPP标准,包括3GPP TS 38.300 V15.0.0 (2017-12)和3GPP TS 38.202 V15.0.0 (2017-12)等。本文主要介绍截止目前(2018年1月25日),3GPP 5G NR相关的协议内容,后期可能会有更新。   本系列共分为两部分:   1. 5G NR协议栈及功能1 - 总体架构与物理层 http://blog...

Wei Xingguang 11万+

Oracle-OracleConnection

Oracle,debezium-connector-oracle,数据迁移,数据变更,CDC

SlothLu的博客 1175

【Niagara Vykon N4 】物联网学习 03照明控制及照明时间表

3.1 设计思路 3.2逻辑组件添加 ①依据原有控制照明逻辑,打开palette,找到schedule模块,添加BoolenSchedule。 ②打开kitContrl,找到Util,并添加BoolenSwitch。 ③剪切到原有的逻辑线,并进行逻辑连接,如下图。 ④新建BooleanWritable,命名为Switch,设置参数并进行逻辑连接,若下图。 3.3界面设计 ⑤至此完成了逻辑的设...

weixin_45217107的博客 2863

QGIS v3.28 高效加载OSM在线地图的三种实用方法

本文详细介绍了在QGIS v3.28中高效加载OSM在线地图的三种实用方法:通过XYZ Tiles直接连接、使用QuickMapServices插件以及配置WMS/WTMS服务。针对每种方法提供了具体操作步骤、常见问题解决方案和性能优化建议,帮助用户根据需求选择最适合的方案,提升GIS工作效率。

weixin_29233333的博客 433

Oracle Data Provider for .NET的使用(托管与非托管(一))

目录 简单的概述 简单的使用 非托管系统要求 托管驱动系统要求 其它的注意事项 ODP.NET版本说明 安装ODP.NET 安装非托管驱动 非托管驱动绿色配置 ...

dfihnkvp27775的博客 843

Verilog的综合指令

Synopsys综合指令

烟花一时的博客 5445

oracle for net,Oracle Data Provider for .NET

Oracle Data Provider for .NETOracle Data Provider for .NET (ODP.NET) features optimized ADO.NET data access to the Oracle database. ODP.NET allows developers to take advantage of advanced Oracle datab...

weixin_39897749的博客 215

手机拍照背后的隐形功臣:一文读懂高通ISP三兄弟(IFE/BPS/IPE)如何协同工作

本文深入解析了高通ISP三兄弟(IFE/BPS/IPE)在手机拍照中的协同工作机制。通过拟人化比喻,详细介绍了IFE作为图像前端引擎的分流预处理、BPS作为RAW格式修图师的专业处理,以及IPE作为全能后期制作人的多面功能,揭示了三者在图像处理pipeline中的高效配合与技术创新。

weixin_27032989的博客 528

智护健康:基于 ESP32 的可穿戴式心率血氧远程监测手环设计与实现

随着健康管理理念的普及,可穿戴式健康监测设备成为刚需。本文设计了一款基于 ESP32 芯片的可穿戴式心率与血氧远程监测手环,通过集成专业生物传感器采集生理数据,借助 ESP32 的无线通信能力实现数据远程传输,搭配手机 APP 与云平台完成数据存储、分析与预警。文中详细阐述了硬件选型、模块接线、软件设计流程及核心代码实现,该手环具备低功耗、高精度、实时性强等特点,可满足日常健康监测与远程照护需求。

weixin_42300449的博客 1199

oracle data provider for .net下载,Oracle Data Provider for .NET

Oracle Data Provider for .NETOracle Data Provider for .NET (ODP.NET) features optimized ADO.NET data access to the Oracle database. ODP.NET allows developers to take advantage of advanced Oracle datab...

weixin_39851887的博客 533

YOLOv11改进策略【注意力机制篇】| 2024 蒙特卡罗注意力(MCAttn)模块,提高小目标的关注度

本文记录的是基于蒙特卡罗注意力(MCAttn)模块的YOLOv11目标检测改进方法研究。利用提高的跨尺度特征提取能力,使模型能够更好地传递和融合提取的多尺度特征,提高对小目标的关注度。Exploiting Scale-Variant Attention for Segmenting Small Medical Objects使用一种基于随机采样的池化操作来生成尺度无关的注意力图。它从三个不同尺度(3×33×33×3、2×22×22×2和1×11×11×1,即池化张量)中随机选择一个1×11×11×1注意力图

Limiiiing的博客 3600

【亲测免费】 Oracle.DataAccess3264位全版本下载:解决Oracle.Data provider for .Net的兼容性问题

Oracle.DataAccess3264位全版本下载:解决Oracle.Data provider for .Net的兼容性问题 【下载地址】Oracle.DataAccess3264位全版本下载 本项目提供了Oracle.DataAccess.dll的全版本下载,这是Oracle.Data provider for ...

gitblog_06719的博客 1049

OpenMM | PDBFixer 用于蛋白质预处理

PDBFixer 用于蛋白质预处理

DrugOne 3006

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Oracle Data Provider for .NET, Managed Driver

Oracle Data Provider for  .NET, Managed Driver Installation Guide, Quick Start, and Release Notes Release 11.2.0.3.50 Beta September 2012 Copyright (c) Oracle Corporation 2012 This do

风随星月 3697

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

Oracle Data Provider for .NET 的使用经验(1)

Oracle Data Provider for .NET 的使用经验                   Oracle Data Provider for .NET 是Oracle提供的基于Ado.net接口的一个开发包。    开发者可以通过它,简单的实现在.net中访问oracle数据库。     因为在开发中一直使用该开发包,所以想基于此谈谈使用该开发包的一些经验。            

xinsir的专栏 7363

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

oracle .net framework,Oracle Data Provider for .NET

Oracle Data Provider for .NETOracle Data Provider for .NET (ODP.NET) 优化了通过 ADO.NET 访问 Oracle 数据库中数据的过程。ODP.NET 允许开发人员利用高级的 Oracle 数据库功能(包括 Real Application Clusters、XML DB 和高级安全性)。这个数据提供程序可与最新的 .NET F...

weixin_28982257的博客 502

Oracle Data Provider for .NET 的使用

转自:http://blog.csdn.net/xinsir/article/details/1011678 Oracle Data Provider for .NET 是Oracle提供的基于Ado.NET接口的一个开发包。     开发者可以通过它,简单的实现在.net中访问oracle数据库。      因为在开发中一直使用该开发包,所以想基于此谈谈使用该开发包的一些经验。    

风随星月 5375

.NET连接ORACLE数据库的方法及示例

  .NET连接ORACLE数据库的方法就目前有3种:1.OLEDB的方式,这种方式要求你要安装oracle client,这两年来做的关于oracle数据库的,我都采用这种方式,虽然连接的速度慢了一点,但是用起来是蛮顺手的,基本能满足要求,连接字串如下:"Provider=OraOLEDB.Oracle.1;Persist Security In

狄青的 1万+

Bulk Operations Using Oracle Data Provider for .NET (ODP.NET) 转载

http://dotnetslackers.com/articles/ado_net/BulkOperationsUsingOracleDataProviderForNETODPNET.aspx Bulk Operations Using Oracle Data Provider for .NET (ODP.NET) Published:31 Oct 2007By:Chinh Do...

weixin_30567225的博客 243

Oracle Data Provider for .NET 的使用经验(3)

前面用OracleDataAdapter访问DB,需要DataSet参数做对应操作。但是在实行固定sql文或者存储过程的时候,我们可以采用OracleCommand 的ExecuteNonQuery()方法。2.1 执行sql文的时候,很简单,只要设置OracleCommand 的CommandText。执行即可。C#例cmd.CommandText = "update emp set sal

xinsir的专栏 1600
上一篇: c#基本语法
下一篇: 使用 ODP.NET 访问 Oracle
leaf829
博客等级 码龄21年 7粉丝 18原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值