Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2007

    Unanswered: Why 'localhost' works but '' does not work

    Hello ALL,

    I install MySQL on a Linux server (ip:, and use following Java code to create a connection to the server via mysql-connector-J.
    String url="jdbc:mysql://localhost/QueryTask_Answer";
    //String url="jdbc:mysql://";
    String databasesuser="root";
    String password="";
    con=Driver.Manager.getConnection(url, databaseuser, password);
    This code works well when it runs locally on the machien (ip:, with the following line

    String url="jdbc:mysql://localhost/QueryTask_Answer";
    but not when replace the line with the following line
    String url="jdbc:mysql://";
    It is strange that the two cases almost the same except the experssion of ip address. I do not know why.
    Last edited by cy163; 09-02-08 at 10:05.

  2. #2
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    check what permissions have been granted to that user for what ip addresses.
    examine any error messages and see what they are trying to tell you.

    after that I'd suggest we move this post to the JAVA forum, as you are probably more likely to resolve such JAVA problems there
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts