Link to home
Start Free TrialLog in
Avatar of Jörg Haberfellner
Jörg HaberfellnerFlag for Austria

asked on

No connection from Visual Studio to an Oracle database

Dear experts!

I am trying to get a connection from Visual Studio 2022 to an Oracle database. Unfortunately, I always get the message: ORA-12514: TNS: Listener cannot currently resolve the service specified in the connect descriptor. I've searched and tried a lot, but nothing works.

The configuration:

Imports Oracle.ManagedDataAccess.Client


Dim oradb As String = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=SVLHR.www.bkhl.at)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=LSAL)));User Id=xxx;Password=yyy;"

Dim conn As New OracleConnection(oradb)

        Try
            conn.Open()

...

The tnsping works:

H:\>tnsping svlhr.www.bkhl.at

TNS Ping Utility for 64-bit Windows: Version 19.0.0.0.0 - Production on 20-NOV-2021 14:36:03

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

Parameterdateien verwendet:
C:\Oracle\product\19.3.0.0\dbhome_1\network\admin\sqlnet.ora

Adapter HOSTNAME zur Aufl÷sung des Alias verwendet
Verbindungsversuch mit (DESCRIPTION=(CONNECT_DATA=(SERVICE_NAME=))(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.4.185)(PORT=1521)))
OK (20 ms)


It's no problem to connect with Oracle SQL Developer. Oracle Client 19c is installed. PATH Variable includes PATH = C:\Oracle\product\19.3.0.0\dbhome_1\bin

The tnsnames.ora is set with the description, but i think i don't need the tnsnames.ora because i set the hole description in my connection string.

What options do i habe now? What can i try?

This is my first request in this forum. I hope I do it right. Thank you in advance for your help.

Jörg

ASKER CERTIFIED SOLUTION
Avatar of Jörg Haberfellner
Jörg Haberfellner
Flag of Austria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial