标签:ring class JD edr SQ pre man root 建立连接
1.连接oracle
String url = "jdbc:oracle:thin:@localhost:1521:ORCL"; String user = "scott"; String password = "tiger"; //1.加载驱动,反射要根据完整的路径查找 Class.forName("oracle.jdbc.driver.OracleDriver"); //2.建立连接 Connection con = DriverManager.getConnection(url,user,password);
2.连接mySql
Class.forName("com.mysql.jdbc.Driver"); //加载MYSQL JDBC驱动程序 Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "050818" + ""); // 连接URL为 jdbc:mysql//服务器地址/数据库名 ,后面的2个参数分别是登陆用户名和密码
标签:ring class JD edr SQ pre man root 建立连接
原文地址:https://www.cnblogs.com/sunxiaoyan/p/9218838.html