Java android远程数据库连接故障
我试图连接到一个远程数据库(在本例中为android中的“localhost”),由于某种原因,我得到一个错误,表示连接被拒绝。我不确定是什么原因造成的,但我猜是下面这条线造成的Java android远程数据库连接故障,java,android,mysql,localhost,Java,Android,Mysql,Localhost,我试图连接到一个远程数据库(在本例中为android中的“localhost”),由于某种原因,我得到一个错误,表示连接被拒绝。我不确定是什么原因造成的,但我猜是下面这条线造成的 response = CustomHttpClient.executeHttpPost("http://localhost/check.php", postParameters); String res=response.toString(); // res
response = CustomHttpClient.executeHttpPost("http://localhost/check.php", postParameters);
String res=response.toString();
// res = res.trim();
res= res.replaceAll("\\s+","");
//error.setText(res);
if(res.equals("1"))
error.setText("Correct Username or Password");
else
error.setText("Sorry!! Incorrect Username or Password");
} catch (Exception e) {
error.setText(e.getMessage());
}
}
});
感谢您的帮助您没有在android实例上运行Web服务器;Android emulator正在开发机器上的虚拟机上运行。尝试使用开发机器的文字IP地址。您没有在android实例上运行Web服务器;Android emulator正在开发机器上的虚拟机上运行。尝试使用开发机器的文字IP地址