我是R的新学员,我编写以下代码以从大量网站获取信息。我想在发生错误时继续循环,并且我不需要知道具体的错误消息。虽然我知道trycatch可以解决这个问题,但我失败了又失败了。错误始终为public class DBConnection {
public static java.sql.Connection connect() throws ClassNotFoundException {
Connection con = null;
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/dmr";
String username = "root";
String password = "root";
try {
// Establishing connection
con = DriverManager.getConnection(url,username,password);
}
catch (SQLException ex) {
System.out.println("SQL Exception : "+ ex);
}
if(con != null){
System.out.println("****CONNECT TO THE DATABASE*****");
}
else{
System.out.println("####NOT CONNECT TO THE DATABASE");
}
return con;
}
}
和Error: unexpected ')' in " )"
。我该如何修改我的代码?
Error: unexpected '}' in "}"
谢谢!