Parthiban
Parthiban

Reputation: 105

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

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

Upvotes: 1

Views: 828

Answers (1)

Jean de Lavarene
Jean de Lavarene

Reputation: 3763

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.

Upvotes: 1

Related Questions