Database connection Statements

Source: Internet
Author: User

Java connection MySQL

  Protected final static String Db_driver = "Com.mysql.jdbc.Driver";

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 connection to SQL Server

  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 # connect to MySQL

  <connectionStrings>

<add name = "Mainconnectionstring"

Connectionstring= "Server=localhost;database=melancholy; Uid=root; Pwd=root.; "

Providername= "System.Data.MySqlClient"/>

</connectionStrings>

C # connecting SQL Server

  <connectionStrings>

<add name = "Myhomeconnectionstring"

connectionstring= "Data source=.;i Nitial Catalog=hotelmanageex; User Id=sa; Password=sa "

Providername= "System.Data.SqlClient"/>

</connectionStrings>

Database connection Statements

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.