Android MySQL Connection
<p>I am trying to connection with php-MySQL using below code </p>

<pre><code>try{
    HttpClient httpclient = new DefaultHttpClient();
    HttpPost httppost = new HttpPost("http://127.0.0.1/mytable.php");
    // HttpPost httppost = new HttpPost("http://localhost/mytable.php");
    httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
    HttpResponse response = httpclient.execute(httppost);
    HttpEntity entity = response.getEntity();
    is = entity.getContent();
}catch(Exception e){
     Log.e("log_tag", "Error in http connection"+e.toString());
}
</code></pre>

<p>when control goes on <code>httpclient.execute(httppost);</code> it throws an exception:</p>

<pre><code>org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1 refused
</code></pre>

<p>I also add <code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;</code> to my AndroidManifest.xml file.</p>

<p>When I test my php file directly from a browser, it works fine. Any suggestions?</p>
