OracleConnection (.NET)

配置oracle连接管理器(cman) Oracle Connection Manager是一个软件组件,可以在oracle客户端上指定安装这个组件,Oracle连接管理器代理发送给数据库服务器的请求,在连接管理器中,我们可以通过配置各种规则来控制会话访问。简而言之,不同于专用连接的1个client对应1个server进程,和共享连接的n个client进程 由dispatcher 向服务器多个共享server发起会话连接管理器将client向客户端发起的会话进行统一管理。 阅读详情
  •  Standard:
    "Data Source=MyOracleDB;Integrated Security=yes;"
    This one works only with Oracle 8i release 3 or later
  •  Specifying username and password:
    "Data Source=MyOracleDB;User Id=username;Password=passwd;Integrated Security=no;"
    This one works only with Oracle 8i release 3 or later
  •  Declare the OracleConnection:
    C#:
    using System.Data.OracleClient;
    OracleConnection oOracleConn = new OracleConnection();
    oOracleConn.ConnectionString = "my connectionstring";
    oOracleConn.Open();


    VB.NET:
    Imports System.Data.OracleClient
    Dim oOracleConn As OracleConnection = New OracleConnection()
    oOracleConn.ConnectionString = "my connectionstring"
    oOracleConn.Open()


    Missing the System.Data.OracleClient namespace? Download .NET Managed Provider for Oracle >>

     

    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   tang

     

     

    Connection String AttributeDefault valueDescription
    Connection Lifetime0Maximum life time (in seconds) of the connection
    Connection Timeout 15Maximum time (in seconds) to wait for a free connection from the pool
    Data Sourceempty stringOracle Net Service Name that identifies the database to connect to
    DBA Privilegeempty stringAdministrative privileges: SYSDBA or SYSOPER
    Decr Pool Size1Controls the number of connections that are closed when an excessive amount of established connections are unused
    EnlisttrueEnables or disables serviced components to automatically enlist in distributed transactions
    Incr Pool Size5Controls the number of connections that are established when all the connections in the pool are used
    Max Pool Size100Maximum number of connections in a pool
    Min Pool Size1Minimum number of connections in a pool
    Password  empty stringPassword for the user specified by User Id
    Persist Security  InfofalseEnables or disables the retrieval of password in the connection string
    PoolingtrueEnables or disables connection pooling
    Proxy User Idempty stringUser name of the proxy user
    Proxy Passwordempty stringPassword of the proxy user
    User Idempty stringOracle 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 Connection Manager,优化数据库连接 文件,设置数据库和客户端以使用Oracle Connection Manager,并启用会话复用功能。通过这些详细步骤和例子,可以掌握Oracle Connection Manager的配置和管理,提高数据库连接的效率和安全性。通过以上步骤,可以成功安装和配置Oracle Instant Client,配置。文件,指定连接要通过Oracle Connection Manager。下载适合您操作系统的Oracle Instant Client。添加Oracle Instant Client的路径到。 阅读详情

相关推荐

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

Oracle ODP.NET ConnectionString

qq_28570965的博客 4079

OracleConnection ,OracleCommand 数据库连接执行

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

YIMI的博客 2513

ADO.NET中的Connection对象

ADO.NET简介:     ADO.NET是一种数据访问技术,使得应用程序可以连接到数据存储,并以各种方式操作存储在其中的数据。该技术基于.NETFramework,与.NET Framework类库的其余部分高度集成。 Connection对象:     实现数据库(数据源)的连接。通过属性可描述数据和用户身份验证,同时提供一些方法允许程序员与数据源建立连接或断开连接。

吴晓如 2984

Oracle-OracleConnection

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

SlothLu的博客 1179

stm32f407等芯片(HAL库)时钟频率修改(乱码)

其他片子及库文件未知、未验证,只是在使用stm32f407ZG配置串口打印的时候,出现乱码,就从以下几方面定位问题: 1. 确认串口GPIO相关配置; 2. 确认波特率等参数; 3. 确认时钟频率; 结果这次使用YH的串口打印程序在ZDYZ的开发板调试项目工程(有点另类...),做功能验证,就出现了以上问题,出于好奇开始调试,最终发现是时钟频率问题。 看到下图这个配置,因为ZDYZ开发板使用的是8MHz外部晶振(好像默认的是25MHz,如图2),所以他这里PLL_M是25,不是推荐值,感...

bulefire2009的博客 5534

postman响应体:“msg“: “请求缺失签名Sign“、 “msg“: “请求缺失时间戳“

请求标头有Sign、Timestamp,但是直接将网址复制到postman时,Headers没有自动生成这两个参数,所以运行时会报错。

m0_46862648的博客 1721

NET3.5 的OracleConnection对象连接Oracle数据库的bug

命名空间:using System.Data.OracleClient 类:OracleConnection   工程名:windowsapplication1 连接代码:           private void button4_Click(object sender, EventArgs e)         {             CheckLink();

cat_curio的专栏 892

高通410随身WiFi刷OpenWRT与Debian双系统一键集成方案

本文详细介绍高通410随身WiFi设备刷入OpenWRT与Debian双系统的一键集成方案。通过虎王工作室提供的一键刷机包,用户可轻松实现双系统部署,兼顾OpenWRT的网络功能与Debian的完整应用服务,适用于网络加速、服务器部署等多种场景,并提供了硬件资源分配与系统切换的实用指南。

docker7nomad的博客 1168

net5使用 Oracle.ManagedDataAccess.Client.OracleConnection问题

net5中使用Oracle.ManagedDataAccess.Client.OracleConnection时报 BinaryFormatter serialization and deserialization are disabled within this application错误的处理: 在项目文件中增加EnableUnsafeBinaryFormatterSerizliation标记: <PropertyGroup> <TargetFramework&...

xtvja的专栏 1635

5、基于模型的系统工程(MBSE)全面解析

本文全面解析了基于模型的系统工程(MBSE),介绍了模型在系统工程中的核心地位,以及如何通过视图和符号表示法实现信息的可视化。文章还详细阐述了MBSE的方法构成,包括框架(本体和视图点)和流程集,探讨了MBSE的实施流程、关键要素、应用策略以及未来发展趋势。通过合理应用MBSE,组织可以提高系统开发的效率和质量,降低成本与风险,实现成功部署。

nft7creator的博客 132

基于IEEE39节点系统的风力发电机组并网改造与稳定性研究

本文研究了基于IEEE39节点系统的风力发电机组并网改造与稳定性问题。首先将系统工作频率从60Hz转换为50Hz,并对同步发电机、变压器、线路和负荷参数进行相应调整。随后将30、32、34、37号节点的同步发电机替换为不同容量的永磁同步发电机(PMSG)和双馈感应发电机(DFIG),详细建立了两种风电机组的数学模型和控制策略。通过Simulink仿真验证,改造后的系统能够稳定运行并满足并网要求。研究成果为大规模风电并网系统仿真提供了参考,对提高电力系统可再生能源消纳能力具有重要意义。

huanghm88的专栏 120

ADO.NET_04_OracleConnection

下面的五个例子主要演示如何使用 OracleConnection 和 OracleCommand 对象,直接把代码放在页面的 Page_Load 事件里。本文在中的例子使用 Oracle 的 scott 用户的表。 演示如何连接 Oracle 数据库 演示如何用 OracleConnectionStringBuilder 构造数据库连接字符串 演示如何判读数据库状态 ...

weixin_34019929的博客 138

【ArcGIS微课1000例】0066:图像融合(全色+多光谱)操作案例教程

图像融合是指将不同类型传感器的影像进行融合,既能使图向具有较高的空间分辨率,又具有多光谱的特性。除了遥感软件如Erdas能进行图像融合,ArcGIS软件也可以进行图像融合等图像增强操作。

智慧空间实验室 3090

ADO.NET_第二篇_OracleConnection/OracleCommand

ADO.NET OracleConnection/OracleCommand

http://www.cnblogs.com/liuning8023/ 988

3dmax文件格式转换——.max 转换为 .flt(解决转换后.flt没有纹理贴图的问题)

本文主要介绍如何在3dmax中将.max格式文件转换为.flt格式文件,并解决转换后的文件没有纹理贴图的问题。 在3dmax中,将.max文件转换为.flt格式,只需导出选择.flt格式即可,但是导出的文件在osgEarth中加载后,缺少纹理和贴图。 下面是解决方案: 1、选中加载的模型,然后点击 渲染-> 渲染到纹理 2、将 渲染到纹理 子窗口往下拉,点击 添加 按钮,添加 ...

cchangcs 6197

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

C# .Net 连接Oracle数据库,提示Oracleclient.oracleconnection已过时

问题:system.data.oracleclient.oracleconnection 已过时 oracleconnection has been deprecated http://go.microsoft.com/fwlink/?linkID=144260解决:在oracle 安装目录下 找到 Oracle.DataAccess.dll添加引用,然后 using Oracle.DataAcc...

Sdnu08gis的专栏 6109

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

.net 1.1 下OracleConnection 无法Open()的错误

1)检查ORACLE目录的权限2)检查是否安装了.Net Framework 1.1 的 sp1

Forekaztor's Folder 861

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

Oracle用 odp.net 时出现 Oracle.DataAccess.Client.OracleConnection的类型初始值设定项引发异常 问题的解决...

在初次使用 Oracle 时,用ado.net连接数据,出现 “Oracle.DataAccess.Client.OracleConnection”的类型初始值设定项引发异常 的提示: 解决方法:将对应版本的 OraOps11W.dll 拷到应用程序目录。 转载于:https://www.cnblogs.com/ppinfo/archive/2013/01/16/2862915...

weixin_30484739的博客 375

如果在ASP.NET程序中用到OracleConnection 接ORACLE(Oracle9i)数据库时的异常

解决办法为: 首先找到ORACLE安装目录:/oracle/ora92设置文件夹ora92的安全属性,添加ASP.NET用户权限。如下图:  确保ASP.NET用户有权限访问oci.dll。 

~笨鸟想飞~ 914

Tips&Tricks系列六:ADO.NET OracleConnection.ClearPool(conn)

最近整理的都是一些小Tip,充数也发上来,希望对大家有所帮助。 前几天在做一个功能时,需要创建一个临时的小数据库Schema,并在程序的最后将此Schema删除,在删除的时候总是提示“ORA-01940: cannot drop a user that is currently connected”,由于程序比较简单,我很确信自己已经关闭了所有连接,甚至Connection对象也都调用了Di...

weixin_33713350的博客 211

oracle命名空间使用,揭秘ADO.NET OracleClient命名空间对象

大家都知道随着技术的发展,访问数据库的方式也很多,不知道大家喜欢用什么方法去访问数据库呢?先给大家介绍常见的几种:开放数据库互联(ODBC)、数据访问对象(DAO)、远程数据对象(RDO)、ActiveX数据对象(ADO)。我们今天主要要学习ADO.NET OracleClient命名空间中的几个常用对象,用这作为对ADO.NET认识学习的开始。ADO.NET是一组访问数据源的面向对象的类库。简单...

weixin_31025595的博客 204

OracleConnection.ConnectionString

OracleConnection.ConnectionString 属性 .NET Framework 2.0 其他版本 3(共 4)对本文的评价是有帮助 - 评价此主题 获取或设置用于打开 Oracle 数据库的字符串。 命名空间:System.Data.OracleClient 程序集:System.Dat

codepython的专栏 3527

OracleConnection is obsolete

用EF搞Oracle的fakeCodeFirst 时,一直报错以下错误: 对类型“System.Data.OracleClient.OracleConnection”的存储区提供程序实例调用“get_ProviderFactory”方法后,返回 null。存储区提供程序可能未正常运行。 同时还报告OracleConnection过时了: 'System.Data.OracleClient...

weixin_30321709的博客 293
上一篇: oracle 连接字符串
下一篇: .net 访问Oracle的连接字符串 (果然BT)
codepython
博客等级 码龄20年 125粉丝 6原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址