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

西门子PLC实战:基于1200/1500的工业物联网MQTT通讯全解析

本文详细解析了如何在西门子S7-1200/1500系列PLC上实现工业物联网MQTT通讯。通过从硬件准备、网络配置到TIA Portal中MQTT_Client功能块的实战编程,手把手指导工程师打通车间数据桥梁,解决信息孤岛问题,实现PLC数据高效上云或设备间互联。

whisky的博客 1089

Oracle-OracleConnection

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

SlothLu的博客 1175

安装oracle 19c 报错INS-06006 INS-44000 INS-32070

数据库版本oracle 19c 操作系统版本:centos7.8 安装oracle19c RAC 配置互信的时候setup显示成功,点test的时候报错INS-44000,继续点yes 报错INS-32070,继续往下点 报错INS-06006 处理过程 1.手动ssh node date 全部成功说明互信时没有问题的 2.查mos 文档ID 2555697.1 如果OpenSSH升级到8.x会有这个问题 MOS上的解决办法 #ssh -V OpenSSH_8.0p1, OpenSSL 1.0.2r 2

cqszpx的博客 1528

STM407ZET6+OV5640调试心得

最近一个项目用了STMF407ZET6 +OV5640,调试了好几天做些总结; STMF407ZET6 开发板用的是正点原子的开发板,OV5640摄像头用的是秉火摄像头; 这其中有一个大坑,开发板的DCMI接口跟摄像头的接口不一样,要重新用杜邦线进行连接; 本人是在正点原子的“”15,ATK-OV5640摄像头模块“”源码上进行修改的。

kingseacjh的专栏 8325

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

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

dfihnkvp27775的博客 843

【数字逻辑电路课程设计】多功能数码管时钟VHDL+quartus II-EP1C12F324C8+源码+付费资源

我希望需要我这篇文章的是正常学习数字逻辑课程且正在设计数码管时钟的同学。我个人不推荐直接获取源代码,因此我另有一份付费资源是完整源代码;我推荐各位去研究我代码的逻辑尝试自己书写属于自己的代码,因此我保留了注释但隐去了变量。由于时间有限,我的设计不够完美,仍有很多缺陷,我将我的展望写在后面,各位可以尝试实现。我不为难同学,作为同学我理解各位设计的辛苦,因此如果有需要,私信我提供隐去敏感信息的学生证照片可直接获取源代码。

WannaFlysyx的博客 1534

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

【Ablation Studies 理解】深度学习模型组件的对比实验/性能分析

Ablation Study 用于检测深度学习/机器学习模型中各部分构件对于整体的重要性。 可以理解为为:组件\tricks重要性测试、组件性能系统性分析、控制变量法、组件去除对比实验、性能敏感性测试、性能因子分析等 Ablation Studies 一些新颖的深度学习模型在论文中都会进行AblationStudy,这部分的主要意义在于系统性的移除模型中的各种组件/trick等因子或者是创新的...

TomRen 4588

使用 MATLAB/Simulink + Simscape Electrical + Simulink Design Optimization,构建一个基于SiC/GaN的Z源逆变器在储能系统中的软启

《手把手教你学Simulink:Z源逆变器在储能系统中的应用》摘要 本文详细介绍了使用MATLAB/Simulink构建Z源逆变器储能系统仿真模型的全过程。Z源逆变器凭借其独特的阻抗网络结构,解决了传统逆变器在直通保护和升压能力方面的痛点。文章通过6个关键步骤:主电路搭建、调制策略设计、软启动实现、仿真分析、效率对比和工程问题解决方案,完整展示了Z源逆变器从理论到仿真的实现路径。重点讲解了直通零矢量SPWM调制策略和渐进式升压比控制方法,验证了系统93.3%的效率和优异的抗扰性能。该模型为光伏储能、电动汽车

MHD0815的博客 122

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

YOLOv9改进策略 | Conv篇 | 2024最新ECCV最新大感受野的小波卷积WTConv助力YOLOv9有效涨点

本文给大家带来的改进机制是一种新的卷积层,称为WTConv(小波卷积层),它利用小波变换(WT)来解决卷积神经网络(CNN)在实现大感受野时遇到的过度参数化问题。WTConv的主要目的是通过对输入数据的不同频率带进行处理,使CNN能够更有效地捕捉局部和全局特征,WTConv成功解决了CNN在感受野扩展中的参数膨胀问题,提供了一种更为高效、鲁棒且易于集成的卷积层解决方案,我将其用于二次创新YOLOv9中的RepNCSPELAN4机制可以减少一定的参数量和计算量,达到一个可观的轻量化作用。

Snu77的博客 1543

【亲测免费】 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

虚幻商城 蓝图汇总

虚幻引擎是一个非常强大和灵活的游戏开发工具,拥有众多的蓝图可以帮助我们更高效地工作。

一碗清深的博客 1507

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

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

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

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

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

xinsir的专栏 7363

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

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、付费专栏及课程。

余额充值