In Android two-dimensional code scanning and generated and the contents of the f

Now get in the Android mobile phone terminal through the SQL command to access the computer on the SQL database (via the Internet). The basic code has been written, but always problems. Hope God can help solve. Hope the specific points thank you. The following is my code and error.
import java.sql.*;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class MainActivity extends Activity {
TextView message = null;
EditText sql_command_et = null;
java.sql.Connection ct = null;
PreparedStatement ps=null;
ResultSet rs=null;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
message = (TextView) findViewById(R.id.message);
Button btn = (Button) findViewById(R.id.btn);
sql_command_et = (EditText) findViewById(R.id.sql_command_et);
message.setText("");// The text box
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); // Loading MYSQL JDBC driver
ct = DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.1.101:1433;databaseName=Heros","sa","sa");


// Connect the URL to the address of the jdbc:mysql// server / database name, the latter 2 parameters are login name and password

} catch (SQLException ee) {
ee.printStackTrace();
} catch (Exception e) {
System.out.print("Error loading Mysql Driver!");
e.printStackTrace();
}
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {

String sql = sql_command_et.getText().toString().trim();
try {
PreparedStatement ps = ct.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
message.append(rs.getString("heroName")+ "\n");

}
rs.close();
ps.close();
ct.close();
} catch (Exception e) {
e.printStackTrace();
}
// message.append(DBManager.selectPwd("10001"));
}
});

}
}


The following appeared to run when the simulator problem. The program no error. But in logcat there has been a lot of strange.

Click the query database will appear below.

Started by Deborah at December 11, 2016 - 12:58 AM

Log means you the main thread is done too many live.
Read and write the database is Flash I/O, preferably on a sub thread or with AsyncTask in the background reading and writing, so as not to block UI.

Posted by Howard at December 25, 2016 - 1:22 AM

Specific point to tell me what to do? Put in a sub thread or AsyncTask that I don't know.

Posted by Deborah at December 30, 2016 - 1:32 AM

Do not know what to learn, ask how much. Their mastery of the more practical.

Posted by Fitch at January 12, 2017 - 2:27 AM

You can go to buidu search, many of the answer

Posted by Quentina at January 13, 2017 - 1:45 AM