See Also

OracleConnection Class  | OracleConnection Members  | Database Property  | ConnectionString Property

Language

Visual Basic

C#

Show All

See AlsoLanguagesDevart.Data.OracleSend comments on this topic.

Server Property

Devart.Data.Oracle Namespace > OracleConnection Class : Server Property (OracleConnection)

Gets or sets the name of TNS alias of the Oracle database to which to connect.

[Visual Basic]
Public Property Server As String
[C#]
public string Server {get; set;}

Return Type

The name of TNS alias of the Oracle database to which to connect. The default value is an empty string ("").

Remarks

In this property you can choose a Home to work with. Homes are enumerated in file named tnsnames.ora. You can use Server property to specify the server detailed instead of alias:
(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = SERVER)(PORT = 1521))) (CONNECT_DATA = (SID = ORCL)))
This is particularly useful for Instant Client, which can be used with Server property set this way. dotConnect for Oracle searches for Instant Client in directories specified by PATH environment variable.

In OracleConnection.Direct mode this property represents host name or IP address of the database server.

Example

The following example creates an OracleConnection and displays the server name.

[C#] 

public void CreateOraConnection() 

  string myConnString = "User ID=scott; Password=tiger; Data Source=ora"; 
  OracleConnection myConnection = new OracleConnection(myConnString); 
  myConnection.Open(); 
  MessageBox.Show("Server: " + myConnection.Server); 
  myConnection.Close(); 

[Visual Basic] 

Public Sub CreateOraConnection()
  Dim myConnString As String = _
    "User ID=scott; Password=tiger; Data Source=ora"
  Dim myConnection As New OracleConnection(myConnString)
  myConnection.Open()
  MessageBox.Show("Server: " + myConnection.Server)
  myConnection.Close()
End Sub

See Also

OracleConnection Class  | OracleConnection Members  | Database Property  | ConnectionString Property

 

 


© 2002 - 2013 Devart. All Rights Reserved.