My Oracle Support Banner

SQL Developer Connection To OCI Database Via SSH Tunnel Is Intermittently Closed By Host After Good Connection (Doc ID 2787504.1)

Last updated on JUNE 29, 2021

Applies to:

Oracle SQL Developer - Version 20.2 and later
Information in this document applies to any platform.

Symptoms

On : 20.2 version, Making and Saving Connections
 
Using SQL Developer (ver 20.2 Java 1.8.0_221) to connect to an OCI oracle database via an SSH tunnel.
Will connect successfully and can execute queries.

After an unspecified amount of time, the connection will close. Get different error messages:

'Connection refused: connect'
  or
'Connection closed by Host'

When trying to connect a new session, get the following error:

An error was encountered performing the requested operation:
IO Error: The Network Adapter could not establish the connection
Vendor code 17002


To recover, you have to completely shut down SQL Developer and restart in order to get a new working connection.
 
Found no pattern to the disconnections. Sometimes it is almost immediate, and sometimes several minutes. Also, have been disconnected while executing a batch of SQL statements.

Same issue occurs when using SQLcl, although the disconnect will not happen when consistently using the application.

Steps Used:

-----------------------------------------------
Connections with SSH Authentication
 ----------------------------------------------
SSH (Secure Shell) authentication enables you to specify that the SSH
protocol should be used to authenticate users attempting to connect to the
database. To enable SSH authentication, click View, and then click SSH. In
the SSH Hosts pane, right-click and select New SSH Host.

Name: A name for the SSH session.

Host: SSH server. SQL Developer will create an SSH session to this host,
using the specified details.

Port: SSH port. The default port is 22.
Username: User name that will be used to authorize the SSH session.

Use Key File: Specifies that a key file should be used to provide
authentication. The key file contains a private key that should correspond to
a public key registered with the server. The key file must be in OpenSSH
format. The server verifies that SQL Developer has access to the proper
private key and thus the user is who he or she claims to be.

Key File: Path to the key file.

When you create an SSH (Secure Shell), you can create one or more local port
forwards and/or remote port forwards.

Name: A name to be given to the local or remote port forward.

Host: Host name for the forward.

Port: Port on the specified host.

Automatically assign [local|remote] port: Lets a port be assigned automatically.

Use specific [local|remote] port: Specify the port to be used.

For detailed information about on the SSH protocol and authorization, see the
OpenBSD man page for ssh:
https://www.openbsd.org/cgi-bin/man.cgi?query=ssh&sektion=1

You may also find the following article helpful: "SSH Tunnel - Local and
Remote Port Forwarding Explained With Examples"
(https://blog.sensible.io/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html)

When using SSH authentication, note the following:

The host name entered into the main connection properties is resolved by the
SSH host. So, to connect to a database on the same host, the SSH host is the
remote server name and the connection host is localhost.

If you choose not to use a key file, or if the selected key file has an
associated passphrase (an added layer of security), a user attempting to open
the connection will be prompted for the password or passphrase.

 

Changes

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Changes
Cause
Solution
References


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.