时间:2021-07-01 10:21:17 帮助过:28人阅读
protected final String DB_URL = "jdbc:mysql://localhost:3306/melancholy?characterEncoding=utf8&useSSL=true";
protected final String DB_USER = "a0109151216";
protected final String DB_PWD = "44045d6f";
Class.forName(DB_DRIVER);
connection = DriverManager.getConnection(DB_URL, DB_USER, DB_PWD);
Java连接SQLserver
private static final String DB_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
private static final String DB_URL = "jdbc:sqlserver://localhost:1433;databasename=easybuy";
private static final String DB_USER = "sa";
private static final String DB_PWD = "sa";
Class.forName(DB_DRIVER);
conn = DriverManager.getConnection(DB_URL,DB_USER,DB_PWD);
C#连接MySQL
<connectionStrings>
<add name ="MainConnectionString"
connectionString="Server=localhost;Database=Melancholy;Uid=root;Pwd=root.;"
providerName="System.Data.MySqlClient"/>
</connectionStrings>
C#连接SQLserver
<connectionStrings>
<add name ="MyHomeConnectionString"
connectionString="Data Source=.;Initial Catalog=HotelManageEx;User ID=sa;Password=sa"
providerName="System.Data.SqlClient"/>
</connectionStrings>
数据库连接语句
标签:sof home har ssl connect source user manager cat