#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2002
    Location
    Boston, MA
    Posts
    30
    Rep Power
    57

    localhost != 127.0.0.1. How to resolve localhost on a network?


    Hey,

    This will probably sound stupid because I don't know anything about networking. It's not even a java question, really. I almost put it in the mysql forum.

    We got DSL and a router for our 2 computers at home. Now localhost maps to the ip for my computer on the router - 192.168.n.n (replace the n's with numbers).

    So if I try to use localhost for anything, there is a problem. I need to explicitly use 127.0.0.1.

    See:
    Code:
    "...
    javax.servlet.ServletException: java.sql.SQLException: Invalid authorization specification: Access denied for user: 'javauser@192.168.
    ..."
    Can someone educate me on this?
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    You're right, this has nothing to do with java Try changing 'localhost' to '127.0.0.1' in your code. That'll probably fix it.

    I don't know why localhost is pointing to your ethernet instead of your loopback. Most likely something played with your routing tables. Try asking in the forum for your OS and see if anyone there can shed some light on the issue.

    Also, you might ask in the MySQL forum about setting up user permissions to let your connect from a remote address. I've only done that with Postgres.
  4. #3
  5. Golden Member =p
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2002
    Location
    Final Frontier
    Posts
    9
    Rep Power
    0
    it doesn't seem that your network is correctly, as networking standards go, no ip other than 127.0.0.1 should be binded to localhost...

    and trying to find localhost of another machine is not gonna
    get you anywhere.

IMN logo majestic logo threadwatch logo seochat tools logo