Search code examples
javamysqldatabase-connectionremote-mysql

Remote MySQL Database Blocked


I have a Java program that connects to a remote MySQL database to store information about students. The program works perfectly on my home network, but when I'm connected to my school's network the connection times out with 100% packet loss. I'm using the same machine, my laptop, in both situations. I'm also unable to ping anything, and I think that it's because of my school's firewall. Is there a way to configure my connection so that this won't happen? I obviously can't change anything on the school's end. Currently, I'm using the following code to establish a connection:

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://remotemysql.com:3306/thenameofthedatabase", username, password);

If there's something I can do in my code to make this connection that would be great. Honestly, though, the most frustrating part of this is that I'm unable to work on the project while at school, so if there are any other workarounds that I could take just to be able to make the connection that would be good as well. Thanks.


Solution

  • Chances are your school's web proxy is blocking any traffic that's not just web (80 & 443). Unless you have a proxy server or host running on one of these ports that will forward your traffic there's probably not much you can do.

    Also, if this is just a school project could you not just run Xampp or something similar on your local machine?