无法连接到外部数据库

时间:2015-04-02 16:09:34

标签: android url connection database-connection

我试图连接到我的外部数据库,但我有一个错误,我不知道为什么,这是我的代码

try{
        String link = "http://127.0.0.1/Myfile.php";
        //HttpClient httpclient = new DefaultHttpClient();
        URL url=new URL(link);
        //HttpPost httppost = new HttpPost(link); //YOUR PHP SCRIPT ADDRESS
// HttpPost httppost = new HttpPost("http://172.23.193.32/elift-test/myfile.php"); //YOUR PHP SCRIPT ADDRESS
        HttpURLConnection response = (HttpURLConnection) url.openConnection();
        response.connect();
        //isr = response.getInputStream();
    }
    catch(Exception e){
        Log.e("log_tag", "Error in http connection "+e.toString());
        resultView.setText("Couldnt connect to database");
    }

0 个答案:

没有答案