Why does the SQL connection get blocked randomly? - sql

SQL Server 2008 R2 runs on Windows Server 2008 R2 in a domain and using the same
domain accounts (Windows authentication) to allow the connection between the client PCs and the SQL Server, created and ODBC source(System DSN named Renta_Equipos) which connects to the database and and the solution. Example: BD <---- DSN <---- WinForm Solution.
The Connection String is an Application.Settings:
Name: ConnectionString_RentaEquipos
Type: (Connection string)
Scope: Application
Value: DSN=Renta_Equipos
Now this is, normally the users log in without problems, but sometimes the connections gets closed for them (not all at the same time, 1-2 of 6 users experiment this) and the only way they can connect again is restarting the client's PC, it happens randomly.
Error it gaves me:
ERROR [08001] [Microsoft][ODBC SQL Server Driver][DBNETLIB] the SQL
server does not exist or access has been denied. ERROR
[01000][Microsoft][ODBC SQL Server Driver][DBNETLIB]Connection Open
(Connect())
I cannot find the problem, I know nothing about configuring an SQL server nor a professional programmer (all I know is from the Internet, books and some little help from other people), so I'm guessing it might be the server, but I can't get it, everything seems to be perfect (for me)
Here is a link for the Github source code: https://github.com/DarkLS/RentaEquipos.git
The error: http://i.stack.imgur.com/O20ls.jpg

Are all 6 of your client PCs desktops? If so, do the 1-2 users whom are having issues use a wired and/or wireless connection (some of the newer desktop towers have wireless capabilities)?
If it's going as far as denying access, you might be hitting your SQL user license cap (hard to say for sure)... Might want to review your SQL Server 2008 R2 environment with your IT guys.
EDIT: Check this site

Related

SQL Server connection failure (name pipes error 40)

I am having an issue at work that is driving me mad. I am new to SQL, and am finding my legs as a system administrator (trial by fire). We have a production server that runs a SQL database and I am trying to mimic the production server in a stand-alone (test) environment. My stand-alone server is of the exact hardware and I have ghosted the production server drives on to the test server (stand-alone) as well. Everything is identical. The only difference is my test server is not in a domain. Its only in a workgroup. My setup consists of one client machine (Windows 7) and the test server running Server 2008r2(SP2)+ SQL Server 2008r2.
We have applications that connect to the database and when I run the applications (connect to the database?), I get the following error.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 5)
I have been researching this error for about 3 months now. I am at my wits end. I have tried all the solutions I could find. Most of the solutions I found here at this site. Enable remote connections-DONE, Firewall execptions-not necessary as I can disable the firewall since I'm on a standalone network, but I have been down that road before and it did not help. I don't think this is a network issue as I am using just a switch with the server and one client connected. I can ping back and forth between the systems.
I've tried so many other solutions that I cant even remember them all. Changed so many settings I've lost count. Thank goodness I can re-image the server back to normal if I feel I've gone to far and changed too many settings to where I can't remember what I've done.
As you can tell, I probably only make things worse the more I try to fix the error, but I have no choice. Everyone is looking at me to fix this and get the test server working, but I need some help. A huge thank you in advance to anyone that can help me solve this. It would be greatly appreciated!

SQL Server does not exist or access denied (intermittently)

I use a Microsoft Access 2010 front end with linked tables on an SQL Server 2012 installation. Local network.
When Access Starts, a VBA script runs which connects to the SQL server and performs some checks.
I recently upgraded from SQL Server 2008 to 2012, that's when the connection between client and Server started to fail intermittently.
When the connection between my client and the server fails, I see a generic message "SQL Server does not exist or access denied". This is covered in a Microsoft support article http://support.microsoft.com/kb/328306. The potential causes detailed in that article do not match the trouble I am encountering.
This connection issue is intermittent. The trouble arises about 3 times a week and lasts for about 30 minutes at a time. Between these 30 minute failures, the the system works perfectly.
My Current VBA Connection String: (have tried several, trouble persists with all of them):
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
conn.Open "Provider=SQLOLEDB;Server=Server3.companydomain.local;Database=My_Database;Trusted_Connection=Yes"
I hope that I can find something in the SQL Server Logs (which I do have access to) but I do not know which Log file to investigate.
I do not have a direct answer to your question, but I believe you could start by exploring the IP and ports on which the SQL server is listening to...Is is possible that the machine using DHCP to assign IP for the DB server as well? In this case I guess it could happen when the IPs are refreshed.
We had a similar issue where multiple IPs were getting assigned on the same machine (having multiple NIC connected) which created such intermittent disruptions.
Well it's been 7 months. Here is the solution for this problem (in my case):
My secondary DNS Server was an external Server. It could not look up my database (192.168.x.x) because this is an internal address.
When My application called the Primary DNS Server to look up the SQL Server address, it worked fine. When my primary DNS was busy, and the application failed over to secondary DNS- the request would time out. There are many reasons someone may see this error. That is the reason I was seeing it.
It's a little strange, but I've found I get this error when I don't have proper "CLOSE DB CONNECTION" type code on my site. And then when too many users hit the site, I start getting this error.
Solution: Do a hard Close of DB connections, after every db call. Yes, most DB Connectors have cleanup routines, but it's not enough under heavy load.
Also, implement a high DB connection limit in the web.config

Connecting to a SQL Server Express 2012 from another computer using MS Access

I have set up an instance of SQL Server Express 2012 on a computer. On this computer I use MS Access as the client to access the data stored on the SQL Server Express. When I open MS Access and click on an object it then prompts me for the SQL Server username and password (I set up a SQL Server Native 11.0 Driver). This works fine. The goal is to put the file on others computers so they can access the data on our SQL Server. I also have enabled the TCP/IP protocols to allow remote connections as well as the Firewall settings that are necessary. However, when I place the file on another computer, it returns SQL Server Error 53.The strange thing is that I have another computer that I tested this on and it works perfectly fine.
My assumption is that I am missing software on the client computer. What software must be present on the client computers so it will be able to access my SQL Server Express on the "server computer"?
Please let me know if you have any questions, at this point I am stumped.
If you're using ODBC, then on the 2nd computer you need to
Start->Control Panel->Data Sources (ODBC)
Select System DSN tab
Click Add...
Select SQL Server Native Client
Give it the same name as the name on the working computer
Select the server to connect to etc.
and you should be OK

Cannot login to sql server 2008 R2 after rebooting server

I am using Windows-server-2008 with Microsoft SQL Server 2008.
And there are a lot of questions about this, but nothing on the internet solved it.
The problem is that i can't connect to the my SQL Server 2008 R2 after rebooting my server.
I placed some new memory in my server, and after rebooting my client/server application didn't work anymore because it cannot reach the database.
So i tried to get in SQL Server Management Studio (SSMS), and tried to loggin with Administrator and another user but both do not work.
When i logg in the following message is displayed:
Cannot connect to (local)
A network-related or instance-specific error occurred while establishing a connection
to SQL Server. The server was not found or was not accessible. Verify that the instance
name is correct and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
(Microsoft SQL Server, Error: 2)
I Tried a lot of different things like:
Rebooting server
Try to start the server manually from Sql Server Configuration Manager
Named Pipes - Enabled
TCP/IP - Enabled
Tried to create an new system user or database user as described in the following article: Click Here
Can somebody please help me? I am really confused because i need to get this online. Otherwise i have to reinstall the database server but i do not have a back-up. (is there some folder with a back-up of the settings/tables/columns are stored and can be imported from reinstall?
I was having the exact same problem. net start mssqlserver was giving me the blurb about a failed login attempt. The problem was that I had recently changed the password for the administrator account, and the new password didn't get updated in services.
Here's how I fixed it:
First locate SQL Server from the list here:
Right click and select properties, and navigate to the Log On tab:
Then I typed the new password, and like magic I was able to start SQL Server right through the services manager.
I also did this for any other processes which were marked as "stopped" even though Startup Type was marked as "automatic" (namely, SQL Server Agent).
Is it a named instance or default? Also, is this a local instance? (I see the "(local)" but just wanted to make sure.)
Start the sql server services from services.msc and try to connect

SQL Server 2008 R2 First Time Login

I've just started work on a new computer in which I had to download all the software fresh.
I've just download a copy of SQL Server 2008 R2, and I'm trying to connect to SQL Server Management Studio without success. I vaguely remember last time I installed this, it asked me to choose between windows, or sql server authentication, however this didn't happen for this installation.
If I try to login via Windows Authentication (where the username and password fields are greyed out, localhost as server name) it gives the following error:
"A Network-related or instance
specific error occured while
establishing a connection to SQL
Server. The server was not found or
was not accessible. Verify that the
instance name is correct and that SQL
Server is configured to allow remote
connections. (provider: Named Pipes
Provider, error: 40 - Could not open a
connection to SQL Server) (Microsoft
SQL Server, Error: 2)"
I have checked everything in SQL Server Configuration Manager, and everything bar VIA is enabled.
If I try SQL Server Authentication, It asks me for a username and password which I definiately have not set yet. Also, under SQL Server Services in configuration manager, there is nothing there.
Any help would be appreciated :)
Thanks
PS: I don't know if it's worth mentioning but I am running Windows 7 as a virtual machine on a Mac.
Are you sure you have the correct instance name? If it was SQL Server 2008 R2 Express Edition then the default instance name is .\SQLEXPRESS.
Also if your using sql authentication to connect try running sql management studio as admin, if you are a limited user your identity might not be mapped to an account in sql server yet but i believe the Administrators user group is.
You need to check if your services are running.
Please type
net start mssqlserver
in your command prompt. Then try to login.
Ended up reinstalling completely and doing a fresh install from a fresh download. When I did this I was brought through the steps of selecting the default instance, and selecting authentication modes.
Working fine now :)
After checking tons of sites looking for an answer to this question, I think I have a simple solution.
Open the sql Server Configuration
Click on the sql server services node
Right Click on Sql server
Click Start.
I have been screwing around with this forever, and this simple method actually worked.