Remote mySQL access with JDBC and blocked server
I've written a couple of database client programs - Java applications written with Eclipse together with JDBC, to access a mySQL server. I'm sure everyone's familiar with the following code:
String dbs_url = "jdbc:mysql://servername/databaseName?user=root&password=123";
Connection connection = DriverManager.getConnection(dbs_url);
Until now, everything's worked fine. However, now I'm in a situation where the mySQL server belongs to an ISP which blocks remote access (port 3306)
only allowing access (as fas as I know) via a phpmyAdmin panel.
How should I modify my code to access this kind of server? I've heard something about using 'SSH tunneling' but I'm not sure how to incorporate it into the above code. Also, doesn't SSH require an addtional account from my ISP? (I'm not in a position to order additional services from my ISP)
I know a lot of people are implementing database access with PHP but I'd prefer to keep the application local if possible.
Thanks for any help
some interesting websites
I have no experience whatsoever, but I found your question interesting. The following websites might be of interest for you :
article of Pankaj Kumar in Javaranch newsletter
Jscape.com and 3sp.com offer Java classes for SSH, but these are not free for download.
In boran.com there's an article mentioning an open source Java class for SSH called MindTerm.
SSH via the web is explained at ece.osu.edu. On Java.net there is a reference to an article of freshmeat.net
And for experience of first hand, someone else will have to help you.
Good luck !
It's not your code, its the server. The phpAdmin runs on that server, so it connects to localhost. Most SQL servers are setup to not allow remote access. You'd have to create a new user in the mysql database where the value of Host was "%", which would allow such user to connect from any IP. By default, most users are all set to connect only from localhost.
Take a look at this thread:
Last edited by Phaelax; 11-19-2005 at 04:28 PM.
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center