android - 无法解析方法createstatement Android Studio
问题描述
请只为我修复它
类连接
我正在使用https://sourceforge.net/projects/jtds/files/jtds/1.2.7/
public class ConnectionDB {
String ip = "192.168.1.103";
String classs = "net.sourceforge.jtds.jdbc.Driver";
String db = "Andro";
String un = "abc";
String password = "1";
@SuppressLint("NewApi")
public Connection CONN() {
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
.permitAll().build();
StrictMode.setThreadPolicy(policy);
Connection conn = null;
String ConnURL = null;
try {
Class.forName(classs);
ConnURL = "jdbc:jtds:sqlserver://" + ip + ";"
+ "databaseName=" + db + ";user=" + un + ";password="
+ password + ";";
conn = DriverManager.getConnection(ConnURL);
} catch (SQLException se) {
Log.e("ERRO", se.getMessage());
} catch (ClassNotFoundException e) {
Log.e("ERRO", e.getMessage());
} catch (Exception e) {
Log.e("ERRO", e.getMessage());
}
return conn;
}
}
和班级登录
ConnectionDB con=new ConnectionDB();
if (!TextUtils.isEmpty(password) &&!TextUtils.isEmpty(email)) {
try {
if (con == null) {
alertDialog.setMessage("Cannot Access To Server");
} else {
String query = "Select * from Partner where lower(username)=lower('" + email + "') and password=N'" + password + "'";
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
if (rs.next()) {
alertDialog.setMessage("Success");
} else {
alertDialog.setMessage("Fail");
}
}
} catch (Exception ex) {
z = "Exceptions";
}
}
我搜索了谷歌并没有找到答案对不起我的英语不好
解决方案
推荐阅读
- php - Symfony 5 - find(ELEMENT) 在删除功能 (CRUD) 中不起作用 (?)
- node.js - 如何在棱镜中创建没有迁移的表?
- django - Django rest中基于JWT Token的认证和授权
- php - 如何向 URL 添加更多用户数据
- firebase - 如何在本机反应中将平面列表转换为列表项?
- python - tflite_runtime 有时会在我的 Coral Dev Board Mini 上冻结
- javascript - Redux 数据更新不分派
- python - 如何在 python 中使用 xarray 将气候数据集相乘?
- python - ML 笔记本中的 Azure Batch API 上升“AttributeError”
- javascript - 将 CSS 应用于通过 JavaScript 加载的 iframe