package dbconn;
import java.sql.*;
public class DBConn {
public static void main(String[] args) throws SQLException {
String host = "jdbc:mysql://localhost/db_prac";
String userName = null;
String passCode = null;
Connection conn = null;
ResultSet resultSet = null;
Statement statement = null;
try {
Class.forName("com.mysql.jdbc.Driver");
conn = DriverManager.getConnection(host, userName, passCode);
} catch(Exception e) {
System.err.print("Error");
}
}
}
我一直在尝试将jdbc与mysql连接起来,但我一直都不成功。我在运行时遇到了forName()和getConnection()方法的错误。我绝对空白有什么不对,哪里出错了。这是我创建问题的代码。但是当将其他程序复制并粘贴到我的IDE(Eclipse和Netbeans)时,它也会在运行时出错。Below is the image of the libraries with I've added. I am tired of searching the results on google. help is needed