Hi everyone,
I have installed odp.net and succesfully connect to the oracle 10g database using the VS 2005 from windows form setting property. I mean when i click Test Connection it succeeds. An "app.config" is automatically created.
Now the problem i am facing is that when i try to retrieve the connection string from the app.config on my windows form with the following code i get "ORA 12154 TNS Error:"could not resolve the connect identifier".
Dim cn As New OracleConnection
cn.ConnectionString = getConnectionString()
Private Function getConnectionString() As String
Dim cnBuilder As New OracleConnectionStringBuilder
With cnBuilder
.DataSource = My.Settings.OraCon
.UserID = My.Settings.OraCOn
.Password = My.Settings.OraCOn
End With
Return cnBuilder.ConnectionString
End Function
I have copied the TNSNAMES.ORA file from the Oracle 10g Server and placed it into the following path:
C:\Oracle\product\10.2.0\client_1\NETWORK\ADMIN\
My TNSNAMES.ORA ENTRY Looks like this:
# tnsnames.ora Network Configuration File: C:\oracle\product\10.1.0\Db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oraserver)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
The SQLNET.ORA file looks like this:
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
I did TNSPING ORCL throught the Command Prompt and get the following results:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>tnsping orcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 24
2009 21:45:32
Copyright (c) 1997, 2005, Oracle. All rights reserved.
C:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
Does anyone know what could be the likely cause of this error.
Much appreciated
Thanx and Cheers
irfi
I have installed odp.net and succesfully connect to the oracle 10g database using the VS 2005 from windows form setting property. I mean when i click Test Connection it succeeds. An "app.config" is automatically created.
Now the problem i am facing is that when i try to retrieve the connection string from the app.config on my windows form with the following code i get "ORA 12154 TNS Error:"could not resolve the connect identifier".
Dim cn As New OracleConnection
cn.ConnectionString = getConnectionString()
Private Function getConnectionString() As String
Dim cnBuilder As New OracleConnectionStringBuilder
With cnBuilder
.DataSource = My.Settings.OraCon
.UserID = My.Settings.OraCOn
.Password = My.Settings.OraCOn
End With
Return cnBuilder.ConnectionString
End Function
I have copied the TNSNAMES.ORA file from the Oracle 10g Server and placed it into the following path:
C:\Oracle\product\10.2.0\client_1\NETWORK\ADMIN\
My TNSNAMES.ORA ENTRY Looks like this:
# tnsnames.ora Network Configuration File: C:\oracle\product\10.1.0\Db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oraserver)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
The SQLNET.ORA file looks like this:
# This file is actually generated by netca. But if customers choose to
# install "Software Only", this file wont exist and without the native
# authentication, they will not be able to connect to the database on NT.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
I did TNSPING ORCL throught the Command Prompt and get the following results:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\Administrator>tnsping orcl
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 24
2009 21:45:32
Copyright (c) 1997, 2005, Oracle. All rights reserved.
C:\oracle\product\10.2.0\client_1\network\admin\sqlnet.ora
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraserver)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
Does anyone know what could be the likely cause of this error.
Much appreciated
Thanx and Cheers
irfi