Oracle连接字符串
原贴地址:https://www.connectionstrings.com/oracle/
.NET Framework Data Provider for Oracle
Using Connection PoolingThe 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. myOracleDB;Min Pool Size=10;
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/;
Privileged Connection with SYSDBA privilegesSYS;DBA Privilege=SYSDBA;
Privileged Connection with SYSOPER privilegesSYSOPER;
Utilizing the Password Expiration functionalityFirst 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=myUsername;Password=myPassword;
Proxy Authentication
dotConnect for Oracle
Oracle Data Provider for .NET / ODP.NET
Using integrated securitySSPI;
Using ODP.NET without tnsnames.ora(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));myPassword;
Article:"Oracle Data Provider for .NET"by Rama Mohan Using the Easy Connect Naming Method (aka EZ Connect)The easy connect naming method enables clients to connect to a database without any configuration. username/password@//myserver:1521/my.service.com;
Port 1521 is used if no port number is specified in the connection string. Make sure that EZCONNECT is enabled in the sqlnet.ora file. NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT) '//' in data source is optional and is there to enable URL style hostname values Easy Connect Naming Method to connect to an InstanceThis one does not specify a service or a port. username/password@myserver//instancename;
Easy Connect Naming Method to connect to a dedicated server instanceThis one does not specify a service or a port. username/password@myserver/myservice:dedicated/instancename;
Other server options: SHARED,POOLED (to use instead of DEDICATED). Dedicated is the default. Specifying Pooling parametersBy default,connection pooling is enabled. This one controls the pooling mechanisms. The connection pooling service creates connection pools by using the ConnectionString property to uniquely identify a pool. myOracle;Oracle Restricting Pool sizeUse this one if you want to restrict the size of the pool. Max Pool Size=40;
The Max Pool Size attribute sets the maximum number of connections for the connection pool. If a new connection is requested,but no connections are available and the limit for Max Pool Size has been reached the connection pooling service waits for the time defined by the Connection Timeout attribute. If the Connection Timeout time has been reached,and there are still no connections available in the pool,the connection pooling service raises an exception indicating that the request has timed-out. Disable PoolingFalse;
Using Windows user authenticationOracle can open a connection using Windows user login credentials to authenticate database users. /;
If the Password attribute is provided,it is ignored. Operating System Authentication is not supported in a .NET stored procedure. Privileged ConnectionsOracle allows database administrators to connect to Oracle Database with either SYSDBA or SYSOPER privileges. SYSDBA;
SYSOPER is also valid for the DBA Privilege attribute. Runtime Connection Load BalancingOptimizes connection pooling for RAC database by balancing work requests across RAC instances. Load Balancing=True;
This feature can only be used against a RAC database and only if pooling is enabled (default). Oracle in OraHome92
Oracle in XEClient
Oracle in OraClient11g_home1
Server SIDServer=serverSID;Oracle Both Server and DbqODBC;[server SID];UID=[userid];
Some feedback on using both Dbq and Server keywords to make this work. Oracle Provider for OLE DB
Trusted ConnectionThis one specifies OS authentication to be used when connecting to an Oracle database. OSAuthent=1;
Oracle XE,VB6 ADOlocalhost:1521/XE;Database=myDataBase;Oracle
TNS-less connection string
Controling rowset cache mechanismSpecifies the type of caching used by the provider to store rowset data. OraOLEDB provides two caching mechanisms; File and Memory. CacheType=File;
Memory is the default value. All the rowset data is stored in-memory which provides better performance at the expense of higher memory utilization. File = All the rowset data is stored on disk. This caching mechanism limits the memory consumption at the expense of performance. Controling the fetchsizeThis one specifies the number of rows the provider will fetch at a time (fetch array). FetchSize=200;
The FetchSize value must be set appropriately depending on the data size and the response time of the network. If the value is set too high,this could result in more wait time during the execution of the query. If the value is set too low,this could result in many more round trips to the database. Valid values are 1 to 429,496,296. The default is 100. Controling the chunksizeThis one specifies the size,in bytes,of the data in LONG and LONG RAW columns fetched and stored in the provider cache. ChunkSize=200;
Providing a high value for this attribute improves performance,but requires more memory to store the data in the rowset. Valid values are 1 to 65535. The default is 100. Using with Microsofts OLE DB .NET Data ProviderThe Microsoft OLE DB .NET Data Provider can utilize OraOLEDB as the OLE DB Provider for accessing Oracle. However this must be enabled in the connection string. OLEDB.NET=True;
The OLEDB.NET connection string attribute must not be used in ADO applications. Using OraOLEDB Custom Properties with Microsofts OLE DB .NET Data ProviderThe SPPrmsLOB and NDatatype properties can only be set as connection string attributes when OraOLEDB is used by OLE DB .NET Data Provider. True;SPPrmsLOB=False;NDatatype=
Using ADO,these properties would have been set as a property on the command. This is not possible if using the Microsofts OLE DB .NET Data Provider. So the properties are specified in the connection string instead. PLSQLRSet: If the stored procedure,provided by the consumer,returns a rowset,PLSQLRSet must be set to TRUE (enabled). NDatatype: This property allows the consumers to specify whether any of the parameters bound to the command are of Oracle's N datatypes (NCHAR,NVARCHAR or NCLOB). This information is required by OraOLEDB to detect and bind the parameters appropriately. This property should not be set for commands executing SELECT statements. However,this property must be set for all other SQLs such as INSERT,UPDATE,and DELETE. SPPrmsLOB: This property allows the consumer to specify whether one or more of the parameters bound to the stored procedures are of Oracle's LOB datatype (CLOB,BLOB,or NCLOB). OraOLEDB requires this property to be set to TRUE,in order to fetch the parameter list of the stored procedure prior to execution. The use of this property limits the processing overhead to stored procedures having one or more LOB datatype parameters. Using distributed transactionsThis one specifies sessions to enlist in distributed transactions. This is the default behaviour. DistribTX=1;
Valid values are 0 (disabled) and 1 (enabled). Microsoft OLE DB Provider for Oracle
Trusted connectionPersist Security Info=Yes;
.NET Framework Data Provider for OLE DB
Microsoft ODBC Driver for Oracle
Microsoft ODBC for Oracle
Connect directlyNo TSN nor DSN required.
Without TSN.ora alternative
.NET Framework Data Provider for ODBC
MSDataShape
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |