Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Mysql url pointer to server instead of localhost

  1. #1
    Member
    Join Date
    Nov 2010
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Mysql url pointer to server instead of localhost

    I current have an app which runs on a server and connector to the database (using localhost, JDBC and Mysql driver)

    I need to run a class on a separate server that will populate a table with all the file on the server
    both computers are networked and iv tried the following -

    //using IP address
     conn = DriverManager.getConnection(jdbc:mysql://192.1.1.1/" + database, 
    user, password);
     
    //using 2nd IP address (2nd network card)
     conn = DriverManager.getConnection(jdbc:mysql://10.10.10.1/" + database, 
    user, password);
     
    //using Host name of the server where the database lives
     conn = DriverManager.getConnection(jdbc:mysql://server/" + database, 
    user, password);

    Any more ideas. otherwise im going to have to ssh into each server using Jsch (ext lib)
    and run a command to get all the files, store them into an array, return it, and then format it and store it to the database

    Thanks for your help
    kurt


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Mysql url pointer to server instead of localhost

    I presume none of those worked? Make sure there are no firewalls preventing remote access to the port, and also try specifying the port for MySQL (which is 3306 by default) - something like:
    DriverManager.getConnection("jdbc:mysql://myhost:3306/" + database);

  3. #3
    Member
    Join Date
    Nov 2010
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Mysql url pointer to server instead of localhost

    Yeah iv tried that with each one. Is there no way of doing this then? Maybe a perl script to do this would be an easier way.

    Thanks for your reply.
    Kurt

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Mysql url pointer to server instead of localhost

    Can the servers even talk to each other?

    As in can you ping one server from the other?

    Also, does the MySQL server listen on external IP's or just on 127.0.0.1?


    // Json

Similar Threads

  1. Null Pointer Exception Help !!
    By AlterEgo1234 in forum Member Introductions
    Replies: 1
    Last Post: March 27th, 2011, 10:07 AM
  2. JNLP webstart application in localhost
    By Jhovarie in forum Threads
    Replies: 2
    Last Post: February 14th, 2011, 06:53 PM
  3. Null Pointer Exception Help!!
    By puzzledstudent in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 11th, 2010, 06:46 PM
  4. Replies: 6
    Last Post: September 19th, 2010, 08:33 PM
  5. [SOLVED] Null Pointer Exception
    By musasabi in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 11th, 2010, 09:25 PM