While working with ADO.NET ActivexDataObject we use datasources for retrieving ,updating,inserting and deleting data.
Oracle is most used database in the modern industry. In Ado.net to make connection we can have multiple options. For this purpose we have different connection string to connect to the Oracle.

Using ODBC
Object Database Connectivity very common in use that comes with the windows installation.
Mostly used for legacy databases.
We can make connection string to oracle database using this class in our code.
// ODBC -- New Microsoft Driver
using System.Data.Odbc;
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString = "Driver={Driver Name};Server=OracleServer.world;Uid=UserName;Pwd=demo;";
conn.Open();
// ODBC -- Oracle Driver
using System.Data.Odbc;
OdbcConnection conn = new OdbcConnection();
conn.ConnectionString = "Driver={Driver Name};Dbq=myDataBase;Uid=UserName;Pwd=demo;";
conn.Open();
This is the first way to make connection and perform communication with the oracle database.
Using OLEDB
Object Linking and Embedding Database is mostly used where we have the Excel and Access Database.
But also can be used for connecting with Oracle Database.
// OleDb -- Oracle Driver
using System.Data.OleDb;
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = "Driver=drivername;Data Source=ServerName;User id=UserName;Password=demo;";
conn.Open();
// OleDb -- Oracle Driver -- Trusted Connection
using System.Data.OleDb;
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = "Driver=drivername;Data Source=ServerName;OSAuthent=1;";
conn.Open();
// or
using System.Data.OleDb;
OleDbConnection conn = new OleDbConnection();
conn.ConnectionString = "Driver=drivername;Data Source=ServerName;User id=admin;Password=pwd";
conn.Open();
0 Comment(s)