I have been trying to connect my Android application to a local database that I have created on my PC for testing purpose. I'm using XAMPP to create the database server.
String driver = "net.sourceforge.jtds.jdbc.Driver";
Class.forName(driver).newInstance();
String connString = "jdbc:jtds:sqlserver://" + server + "/" + database + ";user=" + username + ";password=" + password + ";";
con = DriverManager.getConnection(connString);
I'm using the above mentioned code to create the connection.
Every time it throws the following error:
Network error IOException: DB server closed connection.
I've even tried another approach using ConnectionClass to establish a connection, but still got the same result.
I have also configured the firewall to allow inbound requests. Please help!