jdbc 数据库连接

static {
  try {
   Class.forName("net.sourceforge.jtds.jdbc.Driver");
  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 // 获取数据库连接
 public Connection getConnection() {
  try {
   conn = DriverManager.getConnection(URL, USERNAME, PWD);
  } catch (Exception e) {
   e.printStackTrace();
  }
  return conn;
 }

你可能感兴趣的:(数据库连接)