.NET Framework Data Provider for Oracle connection strings

Connects to

Oracle

  • 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=myUsername;Password=myPassword;
    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
    =myUsername;pwd=myPassword;
  • Omiting tnsnames.ora Alternative

    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
    =myUsername;Password=myPassword;
  • 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=myUsername;Password=myPassword;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;
  • 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=myUsername;Password=myPassword;

    oConn.OpenWithNewPassword(sTheNewPassword);
  • Proxy Authentication

    Data Source=myOracleDB;User Id=myUsername;Password=myPassword;
    Proxy User Id
    =pUserId;Proxy Password=pPassword;
Problems connecting?
Get answer in the Oracle Q & A forum
.NET Framework Class LibrarySystem.Data.OracleClient.OracleConnectionInfo and class library downloads

Articlesread all »

Providers

Connect

Articlesread all »

Didn't find your connection string?

Start over from the connection string reference index - or try a search!

In the Q&A forums you can ask your own question and let somebody help you.

The knowledge articles contains solutions and guides.