java - How do I connect a android app to a mysql database that is not local? -
hey have found plenty of tutorials people making databases on own computer trying connect 1 not local
private class signupa extends asynctask<void, void, void> { @override protected void doinbackground(void... params) { string url = "jbdc:mysql://mywbdb.cjymdxzuzy46.us-east-1.rds.amazonaws.com:3306/mysql"; string dbname = "profiles"; string driver = "com.mysql.jdbc.driver"; properties userinfo = new properties(); userinfo.put("user", "user"); userinfo.put("password", "pass"); try { class.forname(driver); connection conn = drivermanager.getconnection(url + dbname, userinfo); charsequence text = "hello toast!"; toast tost = toast.maketext(getapplicationcontext(), text, toast.length_long); tost.show(); conn.close(); } catch (exception e) { e.printstacktrace(); } return null; } }
i have imported jdbc library , have tried using drivermanager.registerdriver still crashed.also changed url , username , password obvious reasons. please help, thanks!
you wouldn't expose mysql database internet - asking hacked. typically write web service , expose instead. android app make calls web service update database.
Comments
Post a Comment