sql - Why Can't I Connect to My Database Over the Internet -
i have sql database called roottesting , manage @ ip 192.168.1.121. have simple java application connects (or rather, supposed connect it) on internet user named 'user' has host of '%', know make usable computer uses it. here method in program connects database:
public void addtestentry(testentry testentry) throws classnotfoundexception, sqlexception { tests.add(testentry); class.forname("com.mysql.jdbc.driver"); string url = "jdbc:mysql://192.168.1.121/roottesting"; con = drivermanager.getconnection(url, "user", "s@cajaw3a"); preparedstatement statement = con .preparestatement("insert tests values(?, ?, ?)"); statement.setstring(1, testentry.getname()); statement.setint(2, testentry.getcorrect()); statement.setint(3, testentry.getincorrect()); statement.executeupdate(); con.close(); }
this work every time download program on computer on home network, beigecedar, when try on network, school's network, not work , gives standard message signals database not found. can give me suggestion how connect database on internet, no matter network computer running program in?
the ip address connecting called reserved ip address
it local network ( 192.168.0.0/16 ). aside let's address 2 things.
if allowed connect own computer internet (ie: firewall , ports open) can connect using public ip address
you have consider ports school allow open. may block ports required make connection.
Comments
Post a Comment