Friday, February 10, 2012

Cannot connect studio to my SQL Server Express Database

I am brand-new to databases and SQL Server. I have installed express on my machine. I used SQL Server Management Studio Express to create a new database (per the tutorial). Now I would like to access the database from within Visual Studio 2005.

I went to the Server Explorer and selected Connect To Database. I selected Microsoft SQL Server as the Data Source and hit Continue. In the Server Name combobox, I select my computer. However, in the Connect To A Database box the Select or entre a database Name field does not show any databased. When I select "Test Connection" I get the following error.

"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remove connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"

In Server Management Studio, under the database's properties, I have the connections set to Allow Remote connections to this server.

What am I doing wrong?

Thanks,

John

Hi John,

SQL Express installs to an instance name so you need to specify the name of the computer and the name of the SQL instance in the VS connection dialog. If you didn't change anything during installation your instance will be named SQLEXPRESS, so the full name would be:

<your computer>\SQLEXPRESS

When working with an installation on the same computer as VS you can shortcut this name using either:

.\SQLEXPRESS or (local)\SQLEXPRESS

Both the dot (".") and "(local)" substitute for your computers name.

Regards,

Mike Wachal
SQL Express team

Mark the best posts as Answers!

|||

I've got the same problem, I installed sql express in computer A, then I use computer B to connect the sql server by VS2005 but failed. it showed remote logon server not allowed. but I already configure the server allow remote logon!

is it fire wall blocked the connection? if yes, which port I should release it in firewall?

thanks very much

|||

Hi Bnn,

In order to enable remote connections follow the instructions in the Microsoft Knowledge Base article:

914277 How to configure SQL Server 2005 to allow remote connections
http://support.microsoft.com/default.aspx?scid=kb;EN-US;914277

This article includes information about configuring the fire wall. In the future, it would be a better idea to start a separate thread when you have a new question.

Regards,

Mike Wachal
SQL Express team

-
Check out my tips for getting your answer faster and how to ask a good question: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=307712&SiteID=1

No comments:

Post a Comment