我面临错误计算框架
的JSR / RET我认为是因为我的" mysql-connector-java-3.0.17-ga-bin "
依赖关系
compile project(':mysql-connector-java-3.0.17-ga-bin')
我的活动
private static final String TAG = "report";
private static final String DB_URL = "jdbc:mysql://192.168.1.16/apitest";
private static final String USER = "zzz";
private static final String PASS = "zzz";
public void sampletest(View view) {
Send objSend = new Send();
objSend.execute("");
}
private class Send extends AsyncTask<String, String, String> {
String msg = "";
String text = reportname.getText().toString();
@Override
protected String doInBackground(String... strings) {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection conn = DriverManager.getConnection(DB_URL, USER, PASS);
if (conn == null) {
msg = "Connection goes wrong";
}
else {
String query = "INSERT INTO name (test) VALUES ('"+text+"')";
Statement stmt = conn.createStatement();
stmt.executeUpdate(query);
msg = "Successfully insert!!!!!";
}
conn.close();
}
catch (Exception e) {
msg = "Connection goes wrong";
e.printStackTrace();
}
return msg;
}
}