浅析使用JDBC操作MySQL需要添加Class.forName(“com.mysql.jdbc.Driver”)
引言 如果熟悉使用JDBC来连接数据库的同学一定很清楚连接数据库的代码中一定会有依据Class.forName (com.mysql.jdbc.Driver); public static Connection getConnection() throws ClassNotFoundException, SQLException { if(connection == null){ Class.forName(com.mysql.jdbc.Driver); connection = DriverManager.getConnection(jdbc:
下载地址
用户评论