sql - Cannot connect to database using localhost\sqlserver -
i know should aware of such phrases of sudden connections localhost\sqlexpress stopped working. .\sqlexpress , (local)\sqlexpress work, wouldn't big deal if weren't fact working on team project connection strings defined in former format. , have hard time accept shouldn't work anymore spent several hours analysing , reinstalling several sql server versions no avail. (and on way breaking db projects in vs2010 needed reinstall well...).
but here details. mentioned couldn't connect localhost\sqlexpress .\sqlexpress. same symptoms using sql server manager, , connection strings deployment , running wcf services. funnily enough resolving default instance localhost works.
first things first, yes sql server running , sure enabled tcp/ip , set port fixed 1433 although works on colleagues machine tcp/ip disabled. (somewhere along way read localhost can resolved using shared memory when using native sql client guess what's happening on system.)
the setup 1 sql server express 2008 r2 instance , vs2010 on windows 7 professional.
starting sql express errorlog says:
server listening on [ 'any' <ipv6> 1433]. server listening on [ 'any' <ipv4> 1433]. netstat says (excerpt):
tcp 0.0.0.0:1433 machinenename:0 listening tcp [::]:1433 machinenename:0 listening i note absence of 127.0.0.1:1433 , udp on port 1433
in order diagnose problem use sqlcmd find out transport used:
1. localhost\sqlexpress
sqlcmd -slocalhost\sqlexpress -> shared memory sqlcmd -stcp:localhost\sqlexpress -> sql server network interfaces: error locating server/instance specified cannot connect localhost\sqlexpress sql server management studio if specify shared memory protocol
2. localhost
sqlcmd -slocalhost -> tcp sqlcmd -stcp:localhost -> tcp can connect localhost sql server management studio
3. (local)\sqlexpress
sqlcmd -s(local)\sqlexpress -> shared memory sqlcmd -stcp:(local)\sqlexpress -> sql server network interfaces: error locating server/instance specified can connect (local)\sqlexpress sql server management studio
so lost here. highly appreciated.
in ms sql, go configuration tools -> sql server configuration manager select sql server network configuration -> select protocol in right side window enable tcp/ip , restart services in services.msc try connect localhost\sqlexpress
Comments
Post a Comment