Oracle 连接:
public Connection getConn() {
  Connection conn = null;
  try {
   Class.forName("oracle.jdbc.driver.OracleDriver");
   String url = "jdbc:oracle:thin:@202.206.196.109:1521:orcl";
   String username = "****";
   String password = "****";
   conn = DriverManager.getConnection(url, username, password);
  } catch (ClassNotFoundException e) {
   e.printStackTrace();
  } catch (SQLException e) {
   e.printStackTrace();
  }
  return conn;
 }
SQLServer 连接:
public Connection getConn() {
  Connection conn = null;
  try {
   Class.forName("net.sourceforge.jtds.jdbc.Driver");
   String url = "jdbc:jtds:sqlserver://localhost:1433;DatabaseName=db_baoming";
   String username = "****";
   String password = "****";
   conn = DriverManager.getConnection(url, username, password);
  } catch (ClassNotFoundException e) {
   e.printStackTrace();
  } catch (SQLException e) {
   e.printStackTrace();
  }
  return conn;
 }
MySQL连接:
public static Connection getConnection() {
  Connection conn = null;
  try {
   Class.forName("com.mysql.jdbc.Driver");
   conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/bbs", "root", "root");
  } catch (ClassNotFoundException e) {
   e.printStackTrace();
  } catch (SQLException e) {
   e.printStackTrace();
  }
  return conn;
 }