I am making an application for User Logging, when executing the emulator I can register users, verifying the users' stock in my Database, but when I execute the application on my phone, it does not connect to my Database.
This is my connection code to the Database:
public class ConnectionDB extends AppCompatActivity {
Connection connection;
    private static String ip = "192.168.1.9";  //"192.168.33.1";
    private static String port = "1433";
    private static String classs = "net.sourceforge.jtds.jdbc.Driver";
    private static String db = "PHOTOGO";
    private static String user = "mizrahijulio";
    private static String password = "julio1207";
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        }
    //Connection method
    public Connection connectBD(){
         connection=null;
        try {
            //Acces Permition to DB
            StrictMode.ThreadPolicy policicy=new StrictMode.ThreadPolicy.Builder().permitAll().build();
            StrictMode.setThreadPolicy(policicy);
            Class.forName(classs).newInstance();
            connection= DriverManager.getConnection("jdbc:jtds:sqlserver://"+ip+":"+port+";databaseName="+db+";user="+user+";password="+password+";instance=SQLEXPRESS;");
        }catch(SQLException sq){
            Toast.makeText(getApplicationContext(),sq.getMessage(),Toast.LENGTH_SHORT).show();
        }
        catch (ClassNotFoundException cfe){
            Toast.makeText(getApplicationContext(),cfe.getMessage(),Toast.LENGTH_SHORT).show();
        }
        catch (Exception e){
            Toast.makeText(getApplicationContext(),e.getMessage(),Toast.LENGTH_SHORT).show();
        }
        return connection;
    }
    public Connection CloseConnection() throws SQLException {
try{
        if(connection!=null){
             connection.close();}
}
        catch(SQLException sq){
            Toast.makeText(getApplicationContext(),sq.getMessage(),Toast.LENGTH_SHORT).show();
        }
        return connection;
}
 
     
     
    
