I'm trying to fetch data from my Local-Server Using an Android App. I established this using jtds.jdbc Connection. In Emulator It's working fine and fetching Data. While tried to connect using Android device through USB it's Giving the Following Error.
07-05 06:05:32.790: W/Error connection(4660): Network error IOException: failed to connect to /220.127.116.11 (port 1433): connect failed: ENETUNREACH (Network is unreachable)
Here is the code which i'm using to connect SQL-Server Database
Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://18.104.22.168:1433/MyDB", "sa", "password");
I have Some Proxy Setting in My System i Doubt is that Blocking me while trying to access Server-Database. While syncing From USB device from my Computer. My Operating System is Windows 7 Professional, Service Pack 1
Please Help me to Solve this issue.
"Network is unreachable" error occurs when the host is not reachable. Meaning that your application can't connect to the host. This can be due to a number of reasons from you being in a different network that's separate from the one you're trying to connect to.
If you are running the simulator in the same computer that the database is located, try to change 22.214.171.124 to 127.0.0.1 and see if it works.