I receive the error below when running the following function. The catch says the line where it opens the connection (Me.OracleConn.Open()).
I have made sure that the server exists in the TNSNAMES.ora file.
Imports NetOracle = System.Data.OracleClient ... Private Property OracleConn As NetOracle.OracleConnection ... Private Function Connect_To_Oracle() As Boolean Connect_To_Oracle = False Try 'Me.OracleConn = New NetOracle.OracleConnection Me.OracleConn = New System.Data.OracleClient.OracleConnection Me.OracleConn.ConnectionString = "Data Source = (DESCRIPTION=" & _ "(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = servername.net)(PORT = ####)))" & _ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME = risk)));" & _ "User Id=user_name;Password=password;" Me.OracleConn.Open() Connect_To_Oracle = True Catch ex As Exception MsgBox("Oracle Connection Error:" & ex.Message) End Try End Function
Check the permissions of your $ORACLE_HOME: read more at: http://oraclepoint.com/oralife/2010/08/19/oracle-odbc-connection-issue-of-system-exception-ocienvcreate-failed-with-return-code-1-on-windows-with-asp/
Have you tried using ODP.Net without TNSNames? I find it quite easier than struggling with a txt file on your system...
The connection string would look something like this:
Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;
It's basically the same information that you put on the TNSNAMES but instead you put the connection info on your web.config.