Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/183.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java android远程数据库连接故障_Java_Android_Mysql_Localhost - Fatal编程技术网

Java android远程数据库连接故障

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

我试图连接到一个远程数据库(在本例中为android中的“localhost”),由于某种原因,我得到一个错误,表示连接被拒绝。我不确定是什么原因造成的,但我猜是下面这条线造成的

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地址