Using these two setups I am able to access a DB through a ssh tunnel using the SQLdeveloper application:
Tunnel command (using MobaXterm):
ssh -nNT -L 1525:server_1:1521 user@server_2 &
SQL developer connection:
Connection Name: SSHTest
Username: db_schema
Password: db_pw
Hostname: localhost
port: 1525
SID: db_SID
The above successfully connects to the DB
Now I would like to use c# to access the DB using the Oracle.ManagedDataAccess.Client
Have tried various OracleConnection settings, c# example below:
OracleConnection mycon = new OracleConnection();
mycon.ConnectionString = "User Id=db_schema;Password=db_pw;" +
"Data Source = (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)" +
"(HOST = localhost)(PORT = 1525))" +
"(CONNECT_DATA = (SERVICE_NAME = db_SID)))";
mycon.Open();
But the result is always an exception like this:
Oracle.ManagedDataAccess.Client.OracleException
HResult=0x80004005
Message=ORA-12514: TNS:listener does not currently know of service
requested in connect descriptor
Any ideas, comments, etc. would be appreciated.
PS - this PC doesn't have a tnsnames.ora or a listener.ora or an Oracle Client directory, just whatever comes with SQLDeveloper.
Someone commented this might be a repeat of "ORA-12514 TNS:listener does not currently know of service requested in connect descriptor" but it is different because this involves using Oracle.ManagedDataAccess.Client connection from within c# through an open tunnel to a database on a different server.
User contributions licensed under CC BY-SA 3.0