Communicating to database through URLconnection class
I have one Mysql database running in one free database hosting web site which also support PHP. And I have a local java application that interact with the database. but it doesnt work because of a firewall between our network and the internet. However I can access the website, create tables,query data and all other things through the hosting website url. ie, the site itself is not a black listed one in the firewall. But my java program cannot connect to it beacuse the TCP/IP connection going outside the network is blocked by the firewall where as http request to the specified website is allowed.
ie the follwing code doesnt work (but the code is tested and working fine from a computer outside the firewall)
String url = "jdbc:mysql://free-mysql.BizHostNet.com:3306";
String dbName = "/1271245852";
String driver = "com.mysql.jdbc.Driver";
String userName = "myuser";
String password = "mypasswd";
conn = DriverManager.getConnection(url+dbName,userName,pa ssword);
stat = conn.createStatement();
Now my question is that can I use URLconnection class in my local java application which calls a remote mothode written in PHP that inturn calls the database? I believ that URLconnection is http based and can pass the firewall. Is it possible? If yes, can anyone of you please show me how it can be implemented? I am not familiar with PHp and even after many hours of surfing on the internet,I could not see any working example that shows the java PHP communication. Can anyone help me please?