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 -
Code :
//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
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:
Code :
DriverManager.getConnection("jdbc:mysql://myhost:3306/" + database);
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
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