Error while connecting to SQL Server


B) Reason 2: Make sure that your SQL Server instance is running locally because sometimes it stops automatically.

So, question arise - How to check the server status?

Keep follow the following steps: -

Step-1: Open the Run command (Windows Icon + R).
Step-2: Type services.msc
Step-3: A Pop-up “User Account Control” which manages the program for- “Microsoft Management Control” appear before you. Click “OK” button.
Step-4: Go to SQL Server(MSSQLSERVER) Instance and check whether if it is in running mode. If it is not so. Then, Right Click and press Start.

Figure-4 Microsoft Service Window Console
 
Figure-5 Instance is not running
Step-4: The progress bar starts automatically. And once it is finished your instance will changed to running mode. You are done. Just go and re-enter your login credential. This time your will make a successful attempt in accessing your database.

Figure-6 Progress Bar to start execution of selecting process
 
Figure-7 Status change to Running
C) Reason 3: Usually it happens when the database is hosted on some other server/machine and you are working on some different machine. If this is the case, then make sure that you are able access that machine. You can check that by using ping command in Command prompt.

Let’s take a case where my database is hosted on some different machine. And I have no idea whether that server/machine is running or not. Let try to fast follow these steps: -

Step-1: Open the Run Window (Window Icon + R).
Step-2: Type cmd
Step-3: Type the command - ping followed by the IP Address of server/machine where the database is hosted. (Example- ping xxx.xxx.xxx.xxx). See the figure given below.
Step-4: Based on the ping statistics for the server/machine.

Figure-8 Checking the connectivity with external database

(i) If it says that the data packets are 100% or 75% or 50% or 25% lost. This means there is either network issue or maybe the server is not ON.
(ii) If it says that the data packets are not lost (0% lost). Then problem is from your end or machine. Just try with the above two mentioned reasons.

If you are still getting the same error, please restart machine and try again the above solution.


For any query, comment us below.


Next - How to create Flat Files from SQL Server Table?

Related Questions: -


Q-1 Which one of the following command is correct to open Microsoft window service console?
A) service.msc
B) inetmgr
C) ping
D) wuapp
Ans- Option(A).
Explanation: Read more about each command in Top 10 Run Commands 


Click imagination hunt to read latest blogs.

Posted By - +Manish Kumar Gautam +LIVE VIAR +ASP.NET SOLUTIONS

Keep learning and sharing...

Comments

Popular posts from this blog

SSC CGL 2016 Tier-1 Marks / Result

DATA TYPES IN C#

Pattern printing program

IS STRING MUTABLE OR IMMUTABLE IN .NET?

Top Mutual Funds

SSC CGL 2017 TIER 2 RESULT OUT

JUST IN TIME (JIT)

Can we have multiple Main methods in one class

TOP 15 VISUAL STUDIO SHORTCUT KEYS

Top 10 Interview Tips and Questions