Install two databases on a single machine, how to connect a database with a port number to make a database

Source: Internet
Author: User

Recently in the study of the problem, inadvertently encountered this problem (such as the question), has been in their own notebook computer SQLServer2008 test, but today suddenly want to connect to the studio computer database, the connection string connection address written in the studio IP, click Run Program, Half a day no response, and then direct error, no data available, start is the connection user name and password is wrong, and his notebook user name and password is not the same, after the modification or error, no data, think for a half-day reason, Suddenly think it will be my machine installed sql2008 and sql2012 Two database caused, and then began to analyze, found a lot of related materials and related issues, found that it is for this reason, I think the program will directly connected to the sql2012, So to connect the database name is written in the sql2012 database dbtext database, after a few hours of analysis to figure out why, I was first installed sql2008, the default port is 1433, and then install the sql2012, SQL Server uses 1433 ports by default, but because sql2008 is already occupied, sql2012 consumes 3153 ports, and if the normal connection database is usually used to write IP only when the IP address of the server to which the data resides, it will not write the port number or be connected. But the machine installed two data, the engine does not know which to even, so if the direct write IP address, and do not specify the port number, the connection is you first installed on the computer database, my first connection is sql2008, and if you specify the port number, the program will follow your settings to connect, For example, my machine sql2012 occupies the port number is 3153, some friends may not know where to view the occupancy port number, here we can create a new query in the management tool, input:exec sys.sp_readerrorlog 0, 1, ' Listening '




Here we can see that the display occupies a port of 3153, Then we have the database connection string specified in the database server name by default data source = 60.20.8.157 data source =  60.20.8.157,3153 is OK, here you have to see clearly, be sure to see Clearly, IP address and port number is" , " number. Instead of " : "!!!!!!! This must be good, usually in the specified port with a colon, but here is a comma!!!!!!!!!

At this point, you can arbitrarily specify which database on the machine you want to connect to, the solution Ken may not necessarily apply to everyone's situation, I hope to be helpful to everyone!







Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Install two databases on one machine, how to make a database connection by port number when connecting to a database

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.