Can Java program establish JDBC Connection via Proxy Server

前端 未结 2 2001
孤城傲影
孤城傲影 2020-12-19 07:38

I want to communicate to Oracle DB Server which sits outside my network via the proxy server. I can access the web application hosted on the same machine via Browser with p

相关标签:
2条回答
  • 2020-12-19 08:12

    Oracle JDBC (and any other JDBC connections to that extent) are not HTTP-based protocols, so the proxying has to be done at TCP layer.

    For this reason, you can't use Squid Proxy for example (which only does proxying at HTTP layer), but there are many other proxying services that can work at TCP layer:

    • nginx proxy
    • haproxy

    On the former there is a nice step by step guide how to setup JDBC proxying using NGINX https://kwjrnl.wordpress.com/2015/07/27/tcp-proxy-with-nginx-for-jdbc-connection/

    0 讨论(0)
  • 2020-12-19 08:34

    If the proxy is only a HTTP proxy, then no. But if the proxy transfers TCP/IP trafic, then you can.

    How to do that, look at How do I set the proxy to be used by the JVM or http://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html

    0 讨论(0)
提交回复
热议问题