Can not connect to HP\SQLEXPRESS

a network related or instance specific error while spablishing a connection to sql server. The server was not found or was not accessible. Verify that instance name is correct .and the sqlserver is allow to access the remote connection. error 26

Note: We are getting this error while connecting to local database on our pc. while connecting to online database its not generating this error


You will want to ensure that you are connecting to the right instance. Right now it's saying it's not able to find that instance/port #.

open a powershell terminal and execute:

get-service *sql*

This will return the instance name (after the MSSQL$) if it is running on the local host. At that point try to connect to that instance, if you don't see it, then it isn't installed here. Here is a quick and dirty script I posted which will give you the instance name. Requires Powershell V2.0.

$SQLServer = '.'  ##Set Server Name
$SQLService = Get-WmiObject -ComputerName $SQLServer win32_service | where {$_.name -like "MSSQL*"}  #Find instance info from services.
$SQLInstance = $($SQLService.name) #Set name
$SQLInstanceName = $SQLInstance.substring(6) ##Remove MSSQL$ from service name. This is a ghetto method and the best I could do in 5 mins.
write-output "Powershell output- SQL Instance Name is: $($SQLInstanceName)"

Not the answer you're looking for? Browse other questions tagged or ask your own question.