I am comming here to you with issue that makes me crazy. Ok to point. I am developing windows application which is connecting to oracle database, then i retreive the data to excel. I got problem with connection to oracle database, sometimes its connecting and sometimes just not it's lottery. I doing all from this article from oracle site: http://www.oracle.co...s08-088541.html .
My code looks like this: (for test connection)
Dim oradb As String = "Data Source =" _
+ "(DESCRIPTION =" _
+ "(ADDRESS = (PROTOCOL = TCP)(HOST = 179.45.23.11)(PORT = 1521))" _
+ "(ADDRESS = (PROTOCOL = TCP)(HOST = 179.45.23.16)(PORT = 1521))" _
+ "(LOAD_BALANCE = yes)" _
+ "(CONNECT_DATA =" _
+ "(SERVER = DEDICATED)" _
+ "(SERVICE_NAME = act.ge.mert.com)" _
+ ")" _
+ ");User Id=login;Password=password;"
Dim conn As New OracleConnection(oradb) ' VB.NET
Try
conn.ConnectionString = oradb
conn.Open() ' VB.NET
If conn.State = ConnectionState.Closed Then
MsgBox("Not Connected to Oracle.")
Else
MsgBox("Success! You have been connected to oracle")
End If
Catch ex As OracleException
'MsgBox(ex.ToString())
Finally
' Close Connection
conn.Close()
End Try
The Error which i retreiving says:
onlyfortestoracle Oracle.DataAccess.Client.OracleException ORA-12545: Connect failed because target host or object does not exist at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Client.OracleConnection.Open()
The TNS which i take from oracle administrator is:
act.ge.mert.com = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 179.45.23.11)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = 179.45.23.16)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = act.ge.mert.com) ) ) act1.ge.mert.com = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 179.45.23.11)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = act.ge.mert.com) (INSTANCE_NAME = act1) ) ) act2.ge.mert.com = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 179.45.23.16)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = act.ge.mert.com) (INSTANCE_NAME = act2) ) )
I don't know mayby in oradb string i should change something? Please of help.
This post has been edited by nighttrain: 17 May 2012 - 04:37 AM

New Topic/Question
Reply



MultiQuote



|