SQL Server Technical Summary

Source: Internet
Author: User

SQL Server Technical Summary

The default Instance name for ms SQL Server is SQLExpress and the default TCP/IP Port Number is 1433. When a new instance is created instead of the default instance, the default port number is dynamic, therefore, you must specify the corresponding port number. The setting method is as follows: in configuration management, select the corresponding instance in SQL Server network configuration, set the dynamic TCP port in IPALL In the TCP/IP label.

When using SQL Server Management Studio to connect to a database, the Server name format is as follows:

Server IP address, available port number \ [server instance name]

When using Java to connect to the database, the full connection mode has relatively good compatibility.

Public static void main (String [] args ){
String driverName = "com. microsoft. sqlserver. jdbc. SQLServerDriver"; // load the JDBC driver
String dbURL = "jdbc: sqlserver: // localhost: 16103; instanceName = sql2008; DatabaseName = aaaaa"; // connect to the specified database instance
// String dbURL = "jdbc: sqlserver: // localhost: 1433; instanceName = SQLExpress; DatabaseName = aaaaa"; // connect to the default database instance
String userName = "sa"; // Default User Name
String userPwd = "jszx6217"; // User Password
Connection dbConn;
Try {
Class. forName (driverName );
DbConn = DriverManager. getConnection (dbURL, userName, userPwd );
System. out. println ("Connection Successful! "); // If the Connection is Successful, the console outputs Connection Successful!
} Catch (Exception e ){
E. printStackTrace ();
}
}

The connection parameters for connecting to ms SQL SERVER in Java are:

<Strong> "jdbc: sqlserver: // ip address: port number; instanceName = Instance name; DatabaseName = database name" </strong>

This article permanently updates the link address:

Related Article

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.