.Net连接oracle数据库连接字符串

简介:

http://www.connectionstrings.com/oracle#p19

.NET Framework Data Provider for Oracle

Type:    .NET Framework Class Library
Usage:  System.Data.OracleClient.OracleConnection
Manufacturer:  Microsoft
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= yyty; Password= yytyt; Integrated Security= no;
This one works only with Oracle 8i release 3 or later
 
Omiting tnsnames.ora
This is another type of Oracle connection string that doesn't rely on you to have a DSN for the connection. You create a connection string based on the format used in the tnsnames.ora file without the need to actually have one of these files on the client pc.
SERVER= (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID))); uid= yyty; pwd= yytyt;
 
 
Some reported problems with the one above and Visual Studio. Use the next one if you've encountered problems.
Data Source= (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID))); User Id= yyty; Password= yytyt;
 
 
Using Connection Pooling
The connection pooling service will create a new pool if it can't find any existing pool that exactly match the new connections connection string properties. If there is a matching pool a connection will be recycled from that pool.
Data Source= myOracleDB; User Id= yyty; Password= yytyt; Min Pool Size= 10; Connection Lifetime= 120; Connection Timeout= 60; Incr Pool Size= 5; Decr Pool Size= 2;
The first connection opened creates the connection pool. The service initially creates the number of connections defined by the Min Pool Size parameter.

The Incr Pool Size attribute defines the number of new connections to be created by the connection pooling service when more connections are needed.

When a connection is closed, the connection pooling service determines whether the connection lifetime has exceeded the value of the Connection Lifetime attribute. If so, the connection is closed; otherwise, the connection goes back to the connection pool.

The connection pooling service closes unused connections every 3 minutes. The Decr Pool Size attribute specifies the maximum number of connections that can be closed every 3 minutes.
 
Windows Authentication
Data Source= myOracleDB; User Id= /;
 
 
Privileged Connection
With SYSDBA privileges
Data Source= myOracleDB; User Id= SYS; Password= SYS; DBA Privilege= SYSDBA;
http://www.connectionstrings.com/oracle#p19
 
Privileged Connection
With SYSOPER privileges
Data Source= myOracleDB; User Id= SYS; Password= SYS; DBA Privilege= SYSOPER;
 
 
Utilizing the Password Expiration functionality
First open a connection with a connection string. When the connection is opened, an error is raised because the password have expired. Catch the error and execute the OpenWithNewPassword command supplying the new password.
Data Source= myOracleDB; User Id= yyty; Password= yytyt;  

oConn.OpenWithNewPassword(sTheNewPassword);
 
 
Proxy Authentication
Data Source= myOracleDB; User Id= yyty; Password= yytyt; Proxy User Id= pUserId; Proxy Password= pPassword;














本文转自cnn23711151CTO博客,原文链接: http://blog.51cto.com/cnn237111/603039  ,如需转载请自行联系原作者



相关文章
|
2月前
|
SQL 数据库 开发者
达梦数据库 【-6111: 字符串转换出错】问题处理
在更新数据库某个值属性时,遇到了“字符串转换出错”的错误。经过分析,发现是由于 `id` 字段实际上是字符串类型而非数值类型导致的。最终通过将 `id` 的值改为字符串类型解决了问题。此问题提醒我们在处理数据库时要仔细检查表结构,不要凭经验臆断字段类型。
|
3月前
|
SQL 开发框架 .NET
ASP.NET连接SQL数据库:详细步骤与最佳实践指南ali01n.xinmi1009fan.com
随着Web开发技术的不断进步,ASP.NET已成为一种非常流行的Web应用程序开发框架。在ASP.NET项目中,我们经常需要与数据库进行交互,特别是SQL数据库。本文将详细介绍如何在ASP.NET项目中连接SQL数据库,并提供最佳实践指南以确保开发过程的稳定性和效率。一、准备工作在开始之前,请确保您
301 3
|
2月前
|
数据库 C# 开发者
ADO.NET连接到南大通用GBase 8s数据库
ADO.NET连接到南大通用GBase 8s数据库
|
2月前
|
存储 缓存 NoSQL
2款使用.NET开发的数据库系统
2款使用.NET开发的数据库系统
|
2月前
|
数据库连接 数据库 C#
Windows下C# 通过ADO.NET方式连接南大通用GBase 8s数据库(上)
Windows下C# 通过ADO.NET方式连接南大通用GBase 8s数据库(上)
|
2月前
|
数据库连接 数据库 C#
Windows下C# 通过ADO.NET方式连接南大通用GBase 8s数据库(下)
本文接续前文,深入讲解了在Windows环境下使用C#和ADO.NET操作南大通用GBase 8s数据库的方法。通过Visual Studio 2022创建项目,添加GBase 8s的DLL引用,并提供了详细的C#代码示例,涵盖数据库连接、表的创建与修改、数据的增删查改等操作,旨在帮助开发者提高数据库管理效率。
|
3月前
|
Java 数据库
案例一:去掉数据库某列中的所有英文,利用java正则表达式去做,核心:去掉字符串中的英文
这篇文章介绍了如何使用Java正则表达式从数据库某列中去除所有英文字符。
69 15
|
3月前
|
SQL Oracle 关系型数据库
Python连接Oracle
Python连接Oracle
29 0
|
3月前
|
存储 NoSQL API
.NET NoSQL 嵌入式数据库 LiteDB 使用教程
.NET NoSQL 嵌入式数据库 LiteDB 使用教程~
|
3月前
|
SQL 开发框架 .NET
ASP.NET连接SQL数据库:实现过程与关键细节解析an3.021-6232.com
随着互联网技术的快速发展,ASP.NET作为一种广泛使用的服务器端开发技术,其与数据库的交互操作成为了应用开发中的重要环节。本文将详细介绍在ASP.NET中如何连接SQL数据库,包括连接的基本概念、实现步骤、关键代码示例以及常见问题的解决方案。由于篇幅限制,本文不能保证达到完整的2000字,但会确保

推荐镜像

更多