Connecting to Oracle via VB.Net/C# 2.0/3.5/4.0


The included Oracle provider from .Net 2.0 is depricated. Oracle now provides an ADO.Net provider with all of the Linq components and whatever else then included in the 300MB download. Search for ODP.Net to find that. After you install ODP.Net, add a reference in your project to either the 2.0 or 4.0 version (use 2.0 for the .Net Framework 3.5 since it runs the 2.0 runtime).

This is the easiest example of a connection string I’ve found and got to work:

VB.Net

Dim conn As New Oracle.DataAccess.Client.OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=YOUR_FULL_SERVER_IP_ADDRESS)(PORT=YOUR_SERVERS_PORT)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=YOUR_SERVICE_NAME)));User Id=YOUR_USERNAME;Password=YOUR_PASSWORD;")

C#

var conn = new Oracle.DataAccess.Client.OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=YOUR_FULL_SERVER_IP_ADDRESS)(PORT=YOUR_SERVERS_PORT)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=YOUR_SERVICE_NAME)));User Id=YOUR_USERNAME;Password=YOUR_PASSWORD;");

Leave a comment

Please note that we won't show your email to others, or use it for sending unwanted emails. We will only use it to render your Gravatar image and to validate you as a real person.