在Java中与数据库的Postgresql连接失败

在Java中与数据库的Postgresql连接失败,java,android,jdbc,postgis,postgresql-9.2,Java,Android,Jdbc,Postgis,Postgresql 9.2,我尝试从Android应用程序连接到运行在Windows 7上的postgresql server。这两个都是在我的电脑上运行的一个特殊的IP。我试着 String url = "jdbc:postgresql://xx.xx.xx.xx:5432/postgis20"; connect = DriverManager.getConnection(url,"postgres","xxxx"); 该应用程序正在我的电脑上的模拟器中运行。连接包含在过程null之后,我得到的例外是连接尝试失败。那么

我尝试从Android应用程序连接到运行在Windows 7上的postgresql server。这两个都是在我的电脑上运行的一个特殊的IP。我试着

String url = "jdbc:postgresql://xx.xx.xx.xx:5432/postgis20";
connect = DriverManager.getConnection(url,"postgres","xxxx");
该应用程序正在我的电脑上的模拟器中运行。连接包含在过程null之后,我得到的例外是连接尝试失败。那么我的连接有什么问题? 如果我尝试通过sqlshell进行连接,那么一切都正常,并且我使用了相同的参数。SSL设置为否

我还尝试使用而不是我的ip localhost或127.0.0.1,但结果相同

我更改了权限设置以允许访问internet。
但是现在我得到了以下错误:org.postgresql.util.psqleexception:发生了一些异常情况,导致驱动程序失败。请报告此异常。

要在Android上使用jdbc,必须使用StrictMode。这可以通过使用以下代码行来完成:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

要在Android上使用jdbc,必须使用StrictMode。这可以通过使用以下代码行来完成:

StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);