连接数据库

来源:互联网 发布:南方电网 大数据 编辑:程序博客网 时间:2024/05/22 17:26

mysql:

Class.forName("com.mysql.jdbc.Driver");

conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/books","root","root");


SqlServer:

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con=DriverManager.getConnection("jdbc:sqlserver://localhost:1433;Database=company","sa","1");


oracle:

0 0
原创粉丝点击