C#,oracle connection string, sys user solution.

Source: Internet
Author: User
Tags connection pooling current time empty min connect oracleconnection
oracle| Resolution | String System.Data.OracleClientOracleConnection.ConnectionString property The following table is ConnectionStringA valid name is listed in the value in the

Name Default value Description
Data source or server The name or network address of the Oracle instance to which you want to connect
Integrated security ' False ' Whether the connection is a secure connection. The recognizable value is true(strongly recommended),false,Yes , and no.
Password The login password for the Oracle account (not recommended.) To maintain a high level of security, it is strongly recommended that you use the integrated security keyword instead. )
Continuous security information ' False ' When set to false or no(strongly recommended), security-sensitive information, such as a password, is not returned as part of a connection if the connection is open or has been in the open state. Resetting the connection string resets all connection string values, including passwords.
Unicode Specifies whether the. NET Framework data provider used for Oracle uses the UTF16 mode API call. In addition to cases where distributed transactions are not used in Oracle 9i client software, the keyword is ignored in other cases. When communicating with an Oracle 9i server without using Oracle 9i client software, unpredictable results can occur if Unicode is set to true.
User ID Oracle login account (not recommended for use.) To maintain a high level of security, it is strongly recommended that you use the integrated security keyword instead. )

When you set a keyword or connection pool value that requires a Boolean value, you can use ' yes ' instead of ' true ' and ' no ' instead of ' false '. An integer value is represented as a string.

Example

[Visual basic, c#, c++] The following example creates a oracleconnection and sets some of its properties in the connection string. [Visual basic] Public Sub createoracleconnection () Dim myconnstring As String = _ "Data source=oracle8i;integrated security=yes" Dim MyCo Nnection as New oracleconnection (myConnString) Myconnection.open () MessageBox.Show ("ServerVersion:" + Myconnection.serverversion _ + controlchars.newline + "DataSource:" + myconnection.datasource) myconnection.close () end Sub[c#] public void Createoracleconnection () {String myConnString = "Data source=oracle8i;integrated security=yes"; OracleConnection myconnection = new OracleConnection (myConnString); Myconnection.open (); MessageBox.Show ("ServerVersion:" + myconnection.serverversion + "\ndatasource:" + myconnection.datasource); Myconnection.close ();} [C + +] public:void createoracleconnection () {string* myConnString = S "Data source=oracle8i;integrated Security=yes"; oracleconnection* myconnection = new OracleConnection (myConnString); Myconnection->open (); MeSsagebox::show (String::format (S "serverversion: {0}\ndatasource: {1}", Myconnection->serverversion, Myconnection->datasource)); Myconnection->close ();
}

So, using the. NET new managed provider to access Oracle data (System.Data.OracleClient),
cannot be logged on as a sys user.
This only uses the Oracle ODP. NET (can be downloaded to the official Oracle website)

 
 

Connection String Attribute

Default value Description
Connection Lifetime 0 Maximum Life times (in seconds) of the connection when a database connection is returned to a connection pool, its creation time is compared to the current time, if the connection Lifetime the prescribed time, it will be released. is 0 , it will be considered the maximum connection time.
Connection Timeout - 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 then an excessive amount of established connections are unused /c3>
Enlist True enables or disables serviced components to automatically enlist in distributed transactions when this value is true , All existing database connections in the pool will be added to the Transaction context of its creation thread. If the Transaction context does not exist, there will be no change.
INCR Pool Size 5 Controls the number of connections that are established the connections in the pool are
Max Pool Size - 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
     C#... OracleConnection con = new OracleConnection (); Con. ConnectionString = "User id=Scott; Password=tiger;data source=Oracle; Pooling=true; Enlist=true; Min Pool size=10; Connection lifetime=120; Connection timeout=60;incr Pool size=5; DECR Pool size=2 "; Con. Open (); ... 
The following Web sites provide the connection string encyclopedia:
Www.ConnectionStrings.com


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.