How to find why application cannot connect to SQL Server 2008 - sql

Windows application is set to connect to the SQL Server using SQL Server authentication.
When I RDP to the box where the application resides and start the application, it successfully connects to the SQL Server.
When a customer runs the application on his desktop (he is on the network with the application box) and starts the application, connection fails (error. Server does not exist or access denied).
The customer can ping the SQL Server IP in his command prompt.
Yet, when I look at the error log on the SQL server I don't see the logs of his failure to connect.
What could be blocking his access to the SQL Server?

You may have to enable the TCP/IP protocol in SQL Server Configuration Manager - it's disabled by default.

Related

Connect to SQL Server in VM using local machine

I would like to connect SQl server DB in VM using my local sql server management studio.
What should I need for server name ?
Can I use my server Windows authentication for VM in my local ?
Create an empty text file on your VM and give it extension .udl
Doubleclick on it now you can set the properties easy from combobox
Adjust the properties and click on "test connection" until it works
Now open the file in notepad and there you see a complete connection string.
Note that for SQL Server authentication you need to configure the protocol in SQL Server Configuration Manager
When you are in Management studio on your local machine, you will need the hostname or IP address of the VM.
For Windows Authentication, you will need an account on the local domain that both your workstation and the database VM are connected to.
For SQL server authentication, you will need an account in the SQL Server instance.
In both cases, security will need to be configured and associated with your account.
Are you on a domain, or is this just a private server?
Use name of the VM where SQL server is running.
And yes, you can use Windows authentication. Depending on your domain settings.
This will help you How to: Create a SQL Server Login It is not much difference from SQL login.
And if you are in Administrators group on machine running SQL Server, then your login already should be included.
And if your machine with Management Studio and server with SQL Server are in different domains, then you will need to run Management Studio under different account
runas /netonly /user:domain\username "c:\path\ssms.exe"
See Connect to SQL Servers in another domain using Windows Authentication

SQL Server Express - Connect from remote machine

I have two Win 7 64 bit machines.
On the first one I have installed SQL Server 2008 R2 Express and have no trouble connecting via Management Studio with Windows Auth and also via SQL Auth with a user I set up on the database.
On the second machine I am trying to connect to the database on machine 1 using Management Studio. I'm trying SQL Auth. I therefore obviously also can't connect to it via connection string in my .NET Code
I can ping the first machine from the second.
Things I have tried include the following:
On the machine the database is installed make sure the firewall is allowing connection on Port 1433
Made sure SQL Server service is running
Made sure SQL Server Browser service is running
Created an exception for sqlbrowser.exe in the firewall
Enabled TCP/IP Protocol through SQL Configuration manager
Allowed Remote connections in SQL Server Management Studio
The error I get is:
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
This is the connection string I use in code
Data Source=xxx.xxx.xxx.xxx\sqlexpress;Initial Catalog=dbName;User Id=myUser;Password=myPassword;
This can be caused by a number of reasons but I'm glad my suggestion about checking firewall ports (rather than just allowing a one-way exception for SQL Browser) led you to the answer: the firewall wasn't allowing the correct port # through.
If i remember correctly SQL Server disables remote connections by default.
Please check whether remote connections are enabled and enable them if not:
RMB on Server in Management Studio Object Explorer -> Properties -> Connections -> Allow remote connections...

provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server 2005

I have deployed one vb.net desktop application and sql server is used for backend. It is properly working on local machine but when accessing database from remote machine it giving the error in the title.
I have done these things already:
Started SQL server, sql browser service using sql server configuration manager.
added the sql server, browser exe in to firewall allowed program list.
restarted sql server and browser.
enabled TCP/IP, Shared memory, Named pipes in SQL server configuration manager
enabled the remote connection for this DB in database property

SQL Server fails to connect to database on client

I have installed SQL Server 2008 R2 Express on a Windows Server 2008 R2 machine, and now when I want to open that database using SQL Server Management Studio on the client machine it fails to open.
But the database opens normally on the server.
The owner of the database is sa and on client I am logged in with windows authentication.
How to resolve this error??
the server priciple smtech/prabhu is not able to access the database
the user is of client under the server domain
I suggest making sure that the account you are trying to connect with actually has access.
Log onto the server, open up management studio, look in object explorer. There should be a Security folder icon in the treeview, Expand that and the Logins folder.
If the user you are trying to connect with isnt present you may need to add it.
Other than this instead of connecting with windows authentication maybe try connect with SQL Server Authentication as the SA user?
Is both Client and DB sever are on SAME domain ?? If not, then I think Windows Authentication will not work for you.
(As already suggested in above answer) create a SQL Login try with to connect DB from Client using that Login.
If both machine are on same domain and still you are not able to connect server, then few things you can check,
Can your client actually "see" this server over network ??
Most common reason is firewall. By default SQL Server communicates from port 1433 and 1434. Try to see if this MSDN link helps
Make sure that your SQL Server instance is configured to communicate using TCP/IP. This can be configured from SQL Server Configuration Manager.

Unable to Connect to SQL Server 2005 Db From Vista x64 Windows Service

I'm trying to connect to a remote SQL Server 2005 db from a .NET Windows service running in Vista Home Premium x64. I can access the remote db from a console app with no problem. I can connect to a local db from the Windows service with no problem. I was able to connect from a service from XP with no problem. There's no firewall or anti-virus running. How do I configure this service to be able to connect to the remote db?
I've tried to connect by running the Windows service as a local admin account, LocalSystem, LocalService, and NetworkService.
The connection string:
Data source=SERVER_NAME;Initial Catalog=DB_NAME;Integrated Security=True;
The 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)
MORE INFO:
I have also tried to connect using SQL Server authentication with no success:
Data Source=SERVER_NAME;User ID=USER_ID;Password=PWD;Initial Catalog=DB_NAME
This connection string works from the console app too.
MORE INFO:
I ran Process Monitor for the Windows Service and the console app. The Windows service showed \SERVER_NAME\pipe\sql\query was ACCESS DENIED but the console app showed SUCCESS when reading/writing files to \SERVER_NAME\pipe\sql\query.
Good Lord! Why all the gibberish and complex responses on this site. Create a User Account
Either local or Domain and set the service to use that account. Then go into your SQL Server and Add you new account to the Database and set permissions. Voila!
Oh yeah, dont plague yourself with SQL Authentication. Integrated Security is much easier to maintain and without a password in your web.config your much safer.
1) open a command prompt. Type "ping SERVER_NAME". Does it respond? You may have a DNS or connectivity issue if this doesn't work.
2) "telnet SERVER_NAME 1443". Do you see anything or does it refuse your connection? This will definitively tell you whether or not someone is listening on the other end.
3) Go into SQL Server Management Studio. Right click Properties of your server. Select "Connections" from the left side. Is "Allow Remote Connections" checked?
4) Since you're running using network service/system, you will need to make sure you have a login configured on your server for the machine account DOMAIN\CLIENTSYSTEMNAME$. Note the $ sign. This is your machine account, and this will be the user that SQL Server will see.