Hello everyone ,
We have today the steps for how to connecting to oracle from visual studio 2012.
First of all we should have to install the following :
- Visual Studio 2012 or higher from here .
- ODAC with Oracle Developer Tools for Visual Studio from here .
After install Visual Studio we cannot found the ODP.Net data provider under oracle DB data source as the following :
Note: To open data source ( from View -> Server Explorer -> connect to database ).
When we installed ODAC the ODP.Net data provider which we will use it to connecting to oracle Db appeared under oracle DB data source as the following :
Click on ( ODP.Net , managed Driver ) then fill connect information.
To connecting oracle DB from C# code , add a reference of the assembly Oracle.DataAccess.dll in project
Use and replace your connect information in the following code :
OracleConnection con = new OracleConnection();
con.ConnectionString = "User Id=<username>;Password=<password>;Data Source=<datasource>";
Console.WriteLine("Connected to Oracle" + con.ServerVersion);