SQL Server does not exist or access denied (intermittently) - sql

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

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!

Why does the SQL connection get blocked randomly?

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

Has anybody ever used QaasWall to prevent brute force attacks?

We suffered a brute force attempt on our SQL database yesterday and obviously want to prevent this from happening again. The bot or whatever it was was trying to log into the sa account about 30 times a second so in the first instance we have changed the sa account and restricted the IP range that can access SQL via windows firewall. We are also considering disabling the sql server browser and changing the default port.
The problem is none of these things will prevent malicious log in attempts.
I came across a piece of open source software called QaasWall and wondered if anybody had used it and whether it is reputable.
Here is a link to the project site: http://sourceforge.net/projects/qaaswall-window/
Any other tips on how to restrict the number of server log in attempts would be greatly appreciated.
Many thanks.
Clayton.
The best solution is completely disabling access to the database from all hosts which do not need it. E.g. by binding to localhost if the DB is only accessed locally or blocking any connections to the IP/port used by the DB in your firewall.
TheifMaster is correct...the SQL Slammer was really vicious, but installing SQL Server SP3 or SP4 fixed the vulnerability in the sql server listner that this worm exploited. When you install SQL Server 2000 Pre-SP3 from disk your server will get pinged to death...this is why I disable the network connections while installing SQL Server until I can get it fully updated.
I recently installed QAAS Wall on one of my W2003 Servers and it works, but I'm having some difficulties getting the whitelist to work property. It keeps blocking access from one of my database servers.

MS SQL Server 2005 : Error log is too big and getting bigger

I guess someone tries to logon to our sql server and error log is getting bigger. I am running out of space on hdd. What should be the solution?
Cleaning up error log regularly? Howto?
Disabling access to SQL server? For attacker IPs? For local use only? Howto?
Any other?
Regards,
Burak
we had a similar problem here, constant attempts to guess the systems password filled up the log to epic proportions.
you could disable external access via the windows firewall (if you're using windows SBS 2003) its fairly trivial but the end solution we opted for (because we still required external access ourselfs to the database server) was to change the default access port to SQL server; it seemed to stop alot of problems.
although if possible, I would also considering changing the architecture of your network slightly (sometimes this isn't possible if you have purchased some virtual machine from a service provider); moving your database server and disconnecting it from your hub/switch and plugging it into the back of your web server (if this is the ultimate use for your databases) so the web server acts as a type of proxy, prevent all external internet access.
Are you sure logins are the cause of the error-log growth? If so, you could disable remote logins:
Goto START --> Microsoft SQL server 2005 --> Configuration Tools --> SQL server surface area configuration
Select Surface area con figuration for services..
Select Databas engine --> Remote connections and choose 'local only'
Note, this will disable all remote connections to the database, so only change this if your application connects locally!
For emergency you execute sp_cycle_errorlog to start a new one, so you can delete the old one w/o restarting the server.
But the million dollar question is, of course, what is filling up the errorlog? What message shows up again and again? If you tell us that, perhaps we can help you fix the problem and eliminate the errorlog growth.

Sql 2005 Express edition slow connections

I'm running SqlServer 2005 express edition on my laptop for development purposes. It seems that when I open a connection to the database, the setup time is REALLY slow. It can take up to 10 seconds to get a connection. I usually have multiple connections open at the same time (Profiler, Development environment, Query Analyser, etc.) I have a hunch that the slow times are related to the fact that I have multiple connections open.
Is there a governor in Express edition that throttles connection times when multiple connections are made to an instance?
Update:
My workstation is not on active directory, and SQL is running mixed mode security. I will try the login with sql authentication. I am not using user instances.
Update2:
I setup a trace to try and figure out what is going on. When the connection to the database is opened the follow command is executed:
master.dbo.sp_MShasdbaccess
This command takes 6 seconds to execute.
I figured it out. The problem was I had multiple databases with AutoClose set to true. I shut it off in all my databases and the problem went away.
see this article for more info.
Are you sure the connection is the bottleneck? Is it your conn.Open() line that is taking 10 seconds?
AFAIK there's no governer anymore in SQL Express.
Now, are you on a Windows Active Directory Domain? If so, there might be an issue with your DNS or something that means the connection to the domain controller to validate your logon to the server instance is taking the time. I suggest you experiment switching the server over to use SQL Security, give the SA account a password, and try logging in as SA and see if that makes a difference.