android - Postgresql Connection with Database in Java fail -
i try connect android app postgresql server running on windows 7. both running on computer special ip. try
string url = "jdbc:postgresql://xx.xx.xx.xx:5432/postgis20"; connect = drivermanager.getconnection(url,"postgres","xxxx");
the app running in simulator on pc. connect contains after procedure null , exceiption the connection attempt failed. wrong connection? if try connect via sql shell working fine , use same parameter. ssl set no.
i tried use instead of ip localhost or 127.0.0.1 has same result.
i changed permission settings allow access internet. following error: org.postgresql.util.psqlexception: unusual has occured cause driver fail. please report exception.
to use jdbc on android necessary use strictmode. can done using following code lines:
strictmode.threadpolicy policy = new strictmode.threadpolicy.builder().permitall().build(); strictmode.setthreadpolicy(policy);
Comments
Post a Comment