A Common Problem with Connectivity

I have a computer which im treating as a database server (yes, a very weak one...) My problem is that I cannot access the server database from my computer. I've seen this problem ALOT and i've tried all of their answers and they dont seem to be working for me.

My goodies:

import java.sql.*;

publicclass starter

{

public starter()

{

Connection connection =null;

try

{

// Load the JDBC driver

String driverName ="com.mysql.jdbc.Driver";// MySQL MM JDBC driver

Class.forName(driverName).newInstance();

// Create a connection to the database

String serverName ="127.0.0.1:3306";//place server IP here right?

String mydatabase ="DBname";

String url ="jdbc:mysql://" + serverName +"/" + mydatabase;// a JDBC url

String username ="root";

String password ="myPassword";

connection = DriverManager.getConnection(url, username, password );

System.out.println(""+connection );

}

catch (Exception e)

{

System.out.println( e );

}

}

publicstaticvoid main( String args[] )

{

new starter();

}

}

So it compiles and works as is, BUT thats only because the IP is set to localhost. When I place the other computers IP in the 'serverName' field, it DOES NOT WORK! I can't figure this out and some help would be much appreciated.

Thanks for any advice!

[2434 byte] By [ArikArikArika] at [2007-11-27 10:36:09]
# 1

I'm not sure why you insist on embedding connection parameters in code. Better to externalize them, of course.

If the machine you're running this Java code on can't ping the database server, you won't be able to connect to it. Can you ping the IP address of the address server?

%

duffymoa at 2007-7-28 18:39:25 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...