Android的远程数据库连接的麻烦 [英] android remote database connection trouble

查看:125
本文介绍了Android的远程数据库连接的麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在android系统连接到远程数据库在这种情况下,本地主机出于某种原因,我歌厅一个错误说连接以 HTTP ://本地主机拒绝。我不知道是什么原因造成这一点,但我的猜测是它低于

I am trying to connect to a remote database in this case "localhost" in android for some reason I am geting an error saying that Connection to http://localhost refused . i am not sure what is causing this , but my guess is it is this line below

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模拟器在虚拟机上运行的开发机器上。尝试使用您的开发机器的字面IP地址。

You're not running a webserver on your android instance; the Android emulator is running on a virtual machine on your development machine. Try using the literal IP address of your development machine.

这篇关于Android的远程数据库连接的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆