I am developing a client-server software, where the client connects to the database server as follows.
...
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection conexion = DriverManager.getConnection("jdbc:mysql://localhost/agenda", "root", "LA_PASSWORD");
}catch....
...
Both applications are always on the same local network. The problem I have is when the local network uses a proxy, in this case the MySQL connection fails.
How I can make a connection with the Java programming language, a MySQL database when a proxy on the local network?.
Thanks for the help. Greetings!
Try using socksProxyHost
and socksProxyPort
system properties. Look here at chapter "2.4) SOCKS" and here. (The http.proxyHost will not work with JDBC.) Here is description of use proxy with JDBC (Oracle for example): Connect outside internet Oracle Database from inside intranet through JDBC. You may want to use properties: socksProxySet, socksProxyPort, socksProxyHost, java.net.socks.username, java.net.socks.password, socksNonProxyHosts
. Here is description how to set version, username, and password. And ofc you need socks proxy, not HTTP.
If you only have HTTP proxy you can try to tunnel JDBC through HTTP. There are few solutions. For example here is free solution http://sourceforge.net/projects/sqlgateway/ and here commercial http://www.idssoftware.com/jdbcdrv.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With