Remote mySQL access with JDBC and blocked server


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Remote mySQL access with JDBC and blocked server

  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Remote mySQL access with JDBC and blocked server

    Greetings,

    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:

    Class.forName("com.mysql.jdbc.Driver").newInstance();
    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

    JEM

  2. #2
    Join Date
    Jul 2005
    Location
    Antwerp - Belgium
    Posts
    29

    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 !

  3. #3
    Join Date
    Mar 2004
    Posts
    635
    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:

    http://forums.devx.com/showthread.ph...ighlight=mysql
    Last edited by Phaelax; 11-19-2005 at 04:28 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center