title: JDBC connects with 'jdbc:mysql://127.0.0.1:3306/xxx' but hangs and throw socket exception for 'jdbc:mysql://172.29.198.142:3306/xxx'
body: <p>I have a very strange kind of problem here. JDBC connects to mysql server using '127.0.0.1' but when I use real IP-ADDRESS in that place it hangs like forever and throws some socket exception</p>
  
  <p>so 
      "jdbc:mysql://127.0.0.1:3306/xxx"; works like a charm....</p>
  
  <p>"jdbc:mysql://172.29.198.142:3306/xxx"; throws the below ugly Exception...!!</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
  
  The last packet sent successfully to the server was 0 milliseconds ago. The driver   has  not received any packets from the server.
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
  at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1117)
  at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:350)
  at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2408)
  at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2445)
  at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2230)
  at com.mysql.jdbc.ConnectionImpl.&lt;init&gt;(ConnectionImpl.java:813)
  at com.mysql.jdbc.JDBC4Connection.&lt;init&gt;(JDBC4Connection.java:47)
  at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at   sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
  got null
  com.xxxxxxxx.server.test.PersistTest
  at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
  at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
  at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399)
  at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:334)
  at java.sql.DriverManager.getConnection(DriverManager.java:582)
  at java.sql.DriverManager.getConnection(DriverManager.java:185)
  at com.lntinfotech.server.test.PersistTest.testConnectionJDBC(PersistTest.java:204)
  at com.lntinfotech.server.test.PersistTest.main(PersistTest.java:56)
  Caused by: java.net.SocketException: Malformed reply from SOCKS server
  at java.net.SocksSocketImpl.readSocksReply(SocksSocketImpl.java:90)
  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:429)
  at java.net.Socket.connect(Socket.java:529)
  at java.net.Socket.connect(Socket.java:478)
  at java.net.Socket.&lt;init&gt;(Socket.java:375)
  at java.net.Socket.&lt;init&gt;(Socket.java:218)
  at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:259)
  at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:300)
  ... 16 more
  </code></pre>
  
  <p>please help!!!!!!</p>
  
  <p>Thanks in advance...... </p>