向JDBC DriverManager 注册 MySQL Connector/J
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
// Notice, do not import com.mysql.jdbc.*
// or you will have problems!
public class LoadDriver {
public static void main(String[] args) {
try {
// The newInstance() call is a work around for some
// broken Java implementations
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (Exception ex) {
// handle the error
}
}
博客主要讲述了向JDBC DriverManager注册MySQL Connector/J的相关内容,涉及到JDBC和MySQL的结合使用。

1万+

被折叠的 条评论
为什么被折叠?



