Java数据库驱动的加载

来源:互联网 发布:相机透视软件下载 编辑:程序博客网 时间:2024/06/06 20:56

Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost:3306/test";


Class.forName("com.mysql.jdbc.Driver").newInstance();
String url = "jdbc:mysql://localhost:3306/数据库名";


Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=数据库名";


Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url = "jdbc:oracle:thin:@localhost:1521:数据库名";


Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String url = "jdbc:odbc:数据源";

原创粉丝点击