JDBC connections: how to specify a port for data transfer?

I want to start a JDBC connection (Oracle or MSSQL) through a proxy server. The reason for this is the availability of additional traffic control tools, especially for development.

I know, I could specify a proxy server that runs on my machine, and a port in the connection string. But the specified connection settings are accepted only as a kind of handshake to agree on which port the data is transmitted. And this is defenitly not the port that I have under proxy control.

So, does anyone have an idea how to specify a port for data transfer? I would prefer this to be possible in the connection string. The same problem applies to Oracle and MSSQL.

thanks

Leo

+3
source share
1 answer

For Oracle:

jdbc:oracle:<drivertype>:<username/password>@<database> 

<drivertype> is one of

  • thin
  • OCI
  • kprb

The description of <database> somewhat dependent on the type of driver. If the driver type is kprb, then the description of the <database> empty. If the driver type is oci and you want to use the connection to the bike, then <database> empty. Otherwise (thin or oci driver and not testament) the database description is one of the following:

 //<host>:<port>/<service> <host>:<port>:<SID> <TNSName> 

Example:

 jdbc:oracle:oci:@myhost:1521:inst1 

For more information, see Oracle JDBC Information .

0
source

Source: https://habr.com/ru/post/1308009/


All Articles