MS SQLServer 数据库驱动: try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (Exception e) { e.printStackTrace(); } try { String uri = "jdbc:sqlserver://localhost:1433;DatabaseName=test"; String username = "root"; String passwd = "12345"; Connection conn = DriverManager.getConnection(uri, username,passwd); } catch (SQLException e1) { e1.printStackTrace(); } MySQL 数据库驱动: try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e) { e.printStackTrace(); } try { String uri = "jdbc:mysql://localhost/test"; String username = "root"; String passwd = "12345"; Connection conn = DriverManager.getConnection(uri, username,passwd); } catch (SQLException e1) { e1.printStackTrace(); } Oracle 数据库驱动: try { Class.forName("oracle.jdbc.driver.OracleDriver"); } catch (Exception e) { e.printStackTrace(); } try { String uri = "jdbc:oracle:thin:@localhost:1521:test"; String username = "root"; String passwd = "12345"; Connection conn = DriverManager.getConnection(uri, username,passwd); } catch (SQLException e1) { e1.printStackTrace(); }