Connect Oracle cloud DB in JAVA using SSH with Local port forward

Refresh

April 2019

Views

250 time

1

I want to connect to an Oracle db in JAVA which hosted in cloud. I have server private key and remote details to connect.

I can establish SSH connection to server with private key authentication and created SSH tunnel. Now using this tunnel, I can connect to remote server and forwarded session to local port.

Now I used below URL to connect Oracle DB,

"jdbc:oracle:thin:@//localhost:" + local_port_forward + "/service_name", db_user, db_password

But it throws below error:

java.sql.SQLException: Oracle Error: ORA-12650

1 answers

0

The Oracle server may redirect the client (JDBC thin in your example) to a different port than the listener's port. So doing Oracle database connection over an SSH tunnel isn't possible.