1. Download our Official Android App: Forums for Android!

POSTGRESSQL + Android

Discussion in 'Android Lounge' started by arenasam, Aug 20, 2011.

  1. arenasam

    arenasam Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 19, 2011

    Aug 19, 2011
    2
    0
    5
    Good afternoon staff,
    I'm with a difficulty here and would like help from you guys,
    tou trying to connect the android in postgreSQL database on a server that is,
    but getting a tou, code:


    public String Conectar(){
    String retorno;
    try {
    String url;
    url = "jdbc:postgresql://192.168.0.100:5432/bd_motel/";
    Properties props = new Properties();
    props.setProperty("user","postgres");
    props.setProperty("password","123");
    props.setProperty("ssl","false");
    Class.forName("org.postgresql.Driver");
    Connection conn = DriverManager.getConnection(url, props);

    retorno = "Conectei!!!";
    } catch (Exception e) {
    msg = e.getMessage();
    //System.out.println(msg);
    retorno = msg;
    }
    return retorno;
    }

    I'm using android emulator 2.3.1
    Postgre 9.0
    java 1.7
    and the library postgresql-9.0-801.jdbc4
    has changed the claspath tbm but so far nothing, anyone have a suggestion?
     

    Advertisement

  2. arenasam

    arenasam Lurker
    Thread Starter
    Rank:
    None
    Points:
    5
    Posts:
    2
    Joined:
    Aug 19, 2011

    Aug 19, 2011
    2
    0
    5

Share This Page

Loading...