public Connection conn() throws ClassNotFoundException, InstantiationException, IllegalAccessException, SQLException
{
Connection all_connection = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
all_connection = DriverManager
.getConnection("jdbc:mysql://localhost:3306/dbname","username","password");
return all_connection;
}
Above code is my connection code. Its working fine. If i replace localhost by my ip address, its not working. Actually i want to replace localhost by ip address. Replacing localhost by 127.0.0.1 works fine. Why replacing ip address is not working????