I'm able to connect to local SQL server database by using Genymotion emulator. But when generate to APK and run on mobile, it doesn't connect to database. I notice the logcat shows "Connect failed: No route to host". I have turn on my wifi and the signal is very strong.
Below are methods that I have tried but still cannot solve it.
1) Turn ON/OFF wifi when run the app.
2) Set allow remote connection in SQL server.
3) Same network (Local IP= 192.168.0.110 Mobile IP: 192.168.0.114)
4) Using different port (80/1443)
My code:
con = DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.0.110/app", "test", "1234");
or
con = DriverManager.getConnection("jdbc:jtds:sqlserver://192.168.0.110:1443/app", "test", "1234");