To connect to the Oracle© database, initialize a new instance of the TBConnection class via its constructor and invoke its Open() method to open the connection. After successfully opening the connection, you can then proceed to carry out other tasks, such as creating feature classes and features. After completing all required tasks, close the connection by calling TBConnection.Close().
The following code snippet shows the procedure for connecting to AutoCAD Map 3D:
using (Autodesk.Map.IM.Data.TBConnection myConnection =
new Autodesk.Map.IM.Data.TBConnection(
Properties.Settings.Default.Oracle_User,
Properties.Settings.Default.Oracle_Password,
this.Application.Connection.DataSource,
true,
this.Application.Connection))
{
// Open the connection to the database.
// If the DB has no database structure it is created now
myConnection.ShowForms = true;
myConnection.Open();
// Display the connection to the user.
string state = myConnection.State.ToString();
MessageBox.Show("Connection state:" + state);
// Close connection.
myConnection.Close();
}