Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Connecting to MySQL 4.1 over the a LAN



HI,

I've installed mysql 4.1 to windows XP pc and my java swing application running in another windows xp machine.So I need to connect Mysql Database to my swing application...Its already working correctly when I installed mysql in my local pc and write a code as bellow.

public class DB {
private static Connection con;
public static Connection connect()throws Exception{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url="jdbc:mysql://localhost:3306/ecal";
con=DriverManager.getConnection(url,"root","sa");
return con;
}
}

So may I kindly know what is the code for connect remote Mysql Database located in single LAN.

Pls help.

Thank you.
Iranga