I have a dot net executable (build in Visual Studio 2008) that attempts to connect to remote oracle database from a machine that does not have oracle client installed. The error I am getting is
"ORA-12154 TNS Could not resolve the connect identifier specified"
from what I have read so far I needed to add reference Oracle.DataAccess.dll. Oracle.DataAccess was not available for adding under my VS 2008, so I went ahead and got a copy of MSI package (ODTwithODAC1020221.exe from Oracle site) to add the suggested DLL file (I am not sure if there is compatibility issue between my version of VS/.NET 3.5 SP1 and the download). After I have successfully added the reference, i get the above error.
I can successfully do a TNSPING on a local machine that has oracle client. I have also validated database descriptions from TNSNAMES.ORA file.
Here is the code I am using to connect to oracle:
Imports System.IO Imports System.Xml Imports System.Net Imports System.Xml.Schema Imports System.Text Imports System.Data.Common.DataAdapter Imports System.Data.Common.DbDataAdapter Imports System.Net.Mail Imports System.Threading.Thread Imports System.Data.OleDb Imports System.Data.SqlClient Imports System.ServiceProcess Imports System.Management Imports System Imports Oracle.DataAccess Imports Oracle.DataAccess.Client Module Module1 Public Sub Main() Dim sql As String Dim sql2 As String Dim DATABASENAME1 As String = "Data Source=(DESCRIPTION =" _+ " (ADRESS = (PROTOCOL = TCP)(HOST=Server.Host.com)(PORT=1540))" _+ ")" _+ "(CONNECT_DATA = " _+ "(SID=DATABASENAME1)));" _+ "User Id=user;Password=password1;" Dim conn1 As New OracleConnection() conn1.ConnectionString = DATABASENAME1 '%%%%% Connect to database Try conn1.Open() Console.WriteLine("Connection to Oracle database established!") MsgBox("Connection to Oracle database established!") Console.WriteLine(" ") Catch ex As Exception MsgBox("Not Connected" & ex.Message) Console.WriteLine(ex.Message) End End Try END SUB END MODULE
Any suggestion or direction greatly appreciated.