java Java程序可以通过代理服务器建立JDBC连接吗

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12404747/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 08:45:38  来源:igfitidea点击:

Can Java program establish JDBC Connection via Proxy Server

javajdbcproxy

提问by u351545

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 proxy settings. Can a simple Java program establish JDBC Connection thru the proxy server?

我想通过代理服务器与位于我的网络之外的 Oracle DB 服务器进行通信。我可以通过具有代理设置的浏览器访问托管在同一台机器上的 Web 应用程序。一个简单的Java程序可以通过代理服务器建立JDBC连接吗?

*To provide an example will be better *

*提供一个例子会更好 *

Regards.

问候。

回答by kovica

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

如果代理只是一个 HTTP 代理,那么没有。但是,如果代理传输 TCP/IP 流量,则可以。

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

如何做到这一点,看看如何设置 JVMhttp://docs.oracle.com/javase/6/docs/technotes/guides/net/proxies.html使用的代理