.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  ,如需转载请自行联系原作者



相关文章
|
5天前
|
SQL Oracle 关系型数据库
【Oracle】玩转Oracle数据库(一):装上去,飞起来!
【Oracle】玩转Oracle数据库(一):装上去,飞起来!
39 7
|
22天前
|
Oracle 关系型数据库 数据库
Oracle数据库基本概念理解(3)
Oracle数据库基本概念理解(3)
15 2
|
5天前
|
SQL Oracle 关系型数据库
【Oracle】玩转Oracle数据库(七):RMAN恢复管理器
【Oracle】玩转Oracle数据库(七):RMAN恢复管理器
27 4
|
22天前
|
Oracle 关系型数据库 数据库
Oracle数据库基本概念理解(2)
Oracle数据库基本概念理解(2)
13 1
|
5天前
|
存储 SQL Oracle
【Oracle】玩转Oracle数据库(二):体系结构、存储结构与各类参数
【Oracle】玩转Oracle数据库(二):体系结构、存储结构与各类参数
30 7
|
12天前
|
SQL 数据可视化 关系型数据库
轻松入门MySQL:深入探究MySQL的ER模型,数据库设计的利器与挑战(22)
轻松入门MySQL:深入探究MySQL的ER模型,数据库设计的利器与挑战(22)
|
12天前
|
存储 关系型数据库 MySQL
轻松入门MySQL:数据库设计之范式规范,优化企业管理系统效率(21)
轻松入门MySQL:数据库设计之范式规范,优化企业管理系统效率(21)
|
12天前
|
关系型数据库 MySQL 数据库
轻松入门MySQL:精准查询,巧用WHERE与HAVING,数据库查询如虎添翼(7)
轻松入门MySQL:精准查询,巧用WHERE与HAVING,数据库查询如虎添翼(7)
|
14天前
|
存储 关系型数据库 MySQL
数据库字符编码MySQL中使用UTF-8还是UTFB4
数据库字符编码MySQL中使用UTF-8还是UTFB4
19 0
|
18天前
|
缓存 NoSQL 关系型数据库
在Python Web开发过程中:数据库与缓存,MySQL和NoSQL数据库的主要差异是什么?
MySQL是关系型DB,依赖预定义的表格结构,适合结构化数据和复杂查询,但扩展性有限。NoSQL提供灵活的非结构化数据存储(如JSON),无统一查询语言,但能横向扩展,适用于大规模、高并发场景。选择取决于应用需求和扩展策略。
110 1

推荐镜像

更多