--------------------------Mysql数据库----------------------------
url=jdbc:mysql://127.0.0.1:3306/数据库名称
user=root//用户名
password=123456 //密码
---------------------------Oracle数据库--------------------------- String URL = "jdbc:oracle:thin:@localhost:1521:ORCL";
String USERNAME = "system";//用户名
String PWD = "RZKruizhukai123";//密码
-------------------------QLServer2000数据库 --------------------
public Connection getConnection() throws Exception{
//1.创建配置文件并得到对象输入流
InputStream is = this.getClass().getClassLoader().getResourceAsStream("db.properties");
//2.创建propetities
Properties pro= new Properties();
pro.load(is);
//3. 通过key-value 的方式得到相对应的值
String driver = pro.getProperty("driver");
String url = pro.getProperty("url");
String user = pro.getProperty("user");
String password = jdbc.getProperty("password");
//4.加载运行时类对象
Class.forName(driver);
//5通过DriverManager得到连接
Connection connection = DriverManager.getConnection(url,user,password);
return connection;
}