JavaEar 专注于收集分享传播有价值的技术资料

HostConnection::get() New Host Connection established 0xafecbf90

When I receive this message New Host Connection established is the connection ok or not?

I am trying to connect a local database on my application Android

try {
    Class.forName("com.mysql.jdbc.Driver");
    Connection con = DriverManager.getConnection(url, user, pass);
    /* System.out.println("Databaseection success"); */

    Log.i("MYLOG", "Message was not handled.1");
    String result = "Database connection success\n";
    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("select * from depo");
    ResultSetMetaData rsmd = rs.getMetaData();
    Log.i("MYLOG", "Message was not handled.2");
    while (rs.next()) {
        result += rsmd.getColumnName(1) + ": " + rs.getInt(1) + "\n";
        result += rsmd.getColumnName(2) + ": " + rs.getString(2) + "\n";
        result += rsmd.getColumnName(3) + ": " + rs.getString(3) + "\n";
        Log.i("MYLOG", "Message was not handled.3");
    }

    tv.setText(result);
} catch (Exception e) {
   e.printStackTrace();
    tv.setText(e.toString());
}

Log:

05-11 15:28:19.237 2337-2549/mysql.example.com.myapplication D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
[ 05-11 15:28:19.243  2337: 2337 D/         ]
    HostConnection::get() New Host Connection established 0xafecbf90, tid 2337
[ 05-11 15:28:19.574  2337: 2549 D/         ]
    HostConnection::get() New Host Connection established 0xae3e7600, tid 2549
05-11 15:28:19.578 2337-2549/mysql.example.com.myapplication I/OpenGLRenderer: Initialized EGL, version 1.4

1个回答

    最佳答案
  1. I changed minSdkVersion to 16 instead of 15 and it works.