极限第三天
今天主要从事JDBC连接MySQL
try {
Class.forName("com.mysql.jdbc.Driver");
Log.v(TAG, "加载JDBC驱动成功");
} catch (ClassNotFoundException e) {
Log.e(TAG, "加载JDBC驱动失败");
return;
}
String ip = "192.168.0.103";
int port = 3306;
String dbName = "ku";
String url = "jdbc:mysql://" + ip + ":" +...
+ "/" +...;
String user = "root";
String password = "root";
try {
Connection conn = DriverManager.getConnection(url, user, password);
conn.close();
} catch (SQLException e) {
Log.e(TAG, "远程连接失败!");
return;
}
Class.forName("com.mysql.jdbc.Driver");
Log.v(TAG, "加载JDBC驱动成功");
} catch (ClassNotFoundException e) {
Log.e(TAG, "加载JDBC驱动失败");
return;
}
String ip = "192.168.0.103";
int port = 3306;
String dbName = "ku";
String url = "jdbc:mysql://" + ip + ":" +...
+ "/" +...;
String user = "root";
String password = "root";
try {
Connection conn = DriverManager.getConnection(url, user, password);
conn.close();
} catch (SQLException e) {
Log.e(TAG, "远程连接失败!");
return;
}