Can't get SQL server name - sql

I'm trying to add new data source via the data source configuration wizard. I'm using Microsoft SQL Server as data source and .NET framework Data Provider for SQL Server as data provider. In the next window where I have to choose the server name, the list is empty. So I thought one of the SQL services are not working, I opened services.msc and there were 6 services, from which only SQL services vss writer was enabled. I enabled all of them (SQL Server, SQL Server agent, SQL Server browser, SQL Server Active Directory Helper) but the list still is empty. What should I do?

The SQL Browser service is the one used to allow other machines to discover the SQL server's existence on the network, though this requires TCP/IP or Named Pipes to be enabled in the SQL configuration, so check that too.
Also check your firewall isn't blocking the UDP port 1434 (and TCP port 1433 for that matter) [note, these are the default ports; they can be changed in the configuration).

The problem here might be your Database might not have permission over network..
Just try to connect by using Sql Authentication using sa account and password.. This should help you.
The other reason might be if you are using Visual studio 2010 it wont show database from Sql Server 2000
Accept or Vote up if it works for you.

Related

SQL Server Browser - Startup Type - Best Practice

During the installation of SQL Server Express 2012 on a new machine, I am able to specify the startup type of both the SQL Server Database Engine and the SQL Server Browser.
By default, the SQL Server Database Engine has a Startup Type specified as Automatic.
SQL Server Browser has a default Startup Type of Disabled.
After reading about what function SQL Server Browser serves, it would seem that it is something you would want to have running all the time, since it essentially keeps tabs on the various DB instances, and seems like it would speed up development for example.
What are the pros and cons to setting the Startup Type of the SQL Server Browser to Automatic for example? Or to get any use, would you need to set it to Manual and then specify it launch at startup?
Thanks.
From my experience (after making direct access to SQL Server) SQL Server Browser useful if you have Named instances and\or nonstandard(standard is 1433)\dynamic TCP ports.
SQL Server Browser actually listens on UDP port 1434 (default, should be open in firewall) and returns Server\Instance name to IP address\port. If you want to connect from remote client to some MyServer\MSSQL2008 or get available in your network SQL Server Browser will return list of "Instance name\IP address\Port" to your client.

How to connect to sql server database via LAN

want to connect to a database on another PC connected via LAN. I am able to use the sql server db with string like C:\Users... but i cannot connect using string like (\\Server\c\user...) I tried to move the db file to My Documents, still i get this error.
I get the following error message: An attempt to attach an auto-names database for file (\\SERVER\Users\Jeswills\Documents\TBSDB.mdf) failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share
I hope i asked the question correctly
As database does not support the '\SERVER\c...' parameters, i had to attach the database, after enabling TCP/IP and SQL Browser, i had to create a login through security and add it to the attached database file because authentication must be SQL not windows. And i also gave read/write privileges to the account. Then on the child system, i confirmed connection to the account through SSMS with the login connecting to SERVER (which is the remote computer's name).
Note: you must be able to ping the remote systems and SQL Server Express R2 installed. I tried with SQL Server Express but did not get a head way. www.connectionstrings.com/sql-server-2008 for more connection string
Then i used this connection string to connect remotely, making integrated security and user instance = false unlike if i were connecting locally.
Data Source=SERVER\SQLEXPRESS,1433;Database=DATABASEFILE.MDF;Integrated Security=False;Network Library=dbmssocn;Connect Timeout=30;User Instance=False;user='USERNAME';password='PASSWORD'
Not sure what specifically you’re trying to do here but I guess it’s one of these two.
Option 1
Attach database stored on remote shared drive to a local SQL Server
Note that this is only possible starting in SQL Server 2008 R2. If you’re running SQL Server 2008 this is not an option.
Check this for more details
http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive.aspx
Option 2
Connect to remote SQL Server instance from local computer
If that database is already attached to SQL Server instance that runs on the same machine then it’s much better to just connect to that instance from SSMS than trying to attach database from remote storage.
To do this you need to enable TCP/IP protocol in SQL Server Configuration Manager. It’s under SQL Server Network configuration node. Make sure you enable TCP/IP and also set enable the IP address for listening (this is under TCP/IP properties).
Apart from this you’ll want to enable remote connections on your remote instance. This is done from SSMS -> instance properties -> Connection tab
When this is done you should be able to connect to remote instance from local SSMS by typing in IPaddress/instance name. For example 192.168.0.125/{instance_name} or only IP address if this is default instance.

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.

Active Directory User/Groups + SQL Server - Client Cannot locate SQL Server?

I'm doing research on how to integrate users or groups in Active Directory to SQL Server so that users can simply login to Windows and use the application (the connection is thru Windows Authentication).
What I did so far:
Install Windows Server 2008 R2 on a machine with the name "TheServerMachine"
Set "TheServerMachine" as Active Directory domain "MyDomain" controller
Add user User1 to active directory.
Add group Group1 to active directory. (Global, Security)
Add User1 to Group1
Install SQL Server 2008 Express, "SQLEXPRESS" as instance, on "TheServerMachine"
Set server to allow remote connection
The SQL server is in firewal exception
TCP/IP protocol is enabled for the SQL service
Setup the database "MyDatabase"
Add role "MyRules"
Add "MyDomain/Group1" to Login (the dialog box recognizes the group and the domain) with the default database "MyDatabase"
Add user "Group1Users" to "MyDatabase", added a role "MyRules" and set the login I have created.
Add a client machine with the name "Client1" to "MyDomain".
Done!
My problem is, I can't access the SQL server in my client PC which is successfully logged in as "User1" in windows. Using these server path in my ConnectionString, it says that server may not allow remote connection, or the server path may be invalid.
"\\TheServerMachine\SQLEXPRESS"
"\\MyDomain\SQLEXPRESS"
"\\192.168.0.1\SQLEXPRESS"
"TheServerMachine\SQLEXPRESS"
"MyDomain\SQLEXPRESS"
"192.168.0.1\SQLEXPRESS"
Note: My connection string is set "Integrated Security=True".
Do you think it has something to do with my path?
Is it because the domain and SQL server is on the same machine? (I don't think so)
Did I miss some configuration to Domain? Active Directory? SQL Server?
Should I use "SSPI" instead of "True" in "Integrated Security"?
Thanks in advance!
If your TCP/IP protocol is enabled, also make sure that SQL Server Browser service is enabled and started (and set it to automatic if you will be receiving connections from clients).
The SQL Server Browser is use for dynamic port allocation for named instances (in this case SQLEXPRESS is a named instance) and reaches out over port 1434. Also ensure that port 1433 and port 1434 are open.
Edit: Ensure that you are working with SQL Server services through the SQL Server Configuration Manager (SSCM), as the Windows Service Manager/Console snap-in doesn't have the added functionality that SQL Server services require.
First thing that jumps to mind is that SQLExpress isn't configured for remote connections out of the box. Instructions on how to do that
You might run into some other issues after this but try the things in that article first.
And indeed you did already establish that you configured SQLExpress for remote connections. Next item that popped out was your uncertainty on connection string with Integrated security true vs SSPI. What does the current connection string look like? I would assume something like
Data Source=.\SQLExpress;Integrated Security=True;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf
This SO question has plenty of troubleshooting and a wonderful title SQL Express connection string hell ASP.Net

Connecting to a fresh SQL Server installation

I know mysql, and I'd like to learn sqlserver.
I'm currently stuck on the basics of basics:
How to install and configure sql server
How to connect to it
I installed Sql Server through Web Platform Installer, and have Visual Studio 2008 installed. Still, I can't understand how to connect to my server:
I see that the SQL service itself (SQLEXPRESS) is running in both in services.msc and Sql Server Configuration Manager
I try to connect to it via the Management Studio, but I don't understand what to do.
Where do I begin?
Start Management Studio and Select Database Engine as your SqlExpress instance then choose Windows Authentication and press connect. After that in object explorer you will see your databases if you want to create one right click databases and create new one.
You can look at http://msdn.microsoft.com/en-us/library/ms186312.aspx
There are two types of ways you can install a SQL Server instance:
1. Named Instance
2. Default Instance
When you use the default instance, and it's the only instance on the machine, the server would listen directly on the port 1433 which is the default SQL Server port. This is what you'd expect if you come from a mysql background.
When you "name" an instance, such as SQLEXPRESS, it works differently. You connect to a special service (SQL Server Browser Service) which now listens on that port, and points the client to the "correct" port of the named instance. I hope I'm being accurate about this one, but that's what happens in general.
You could connect directly to the named instance if you see what port it binds to in the SQL Server error log, and if you could choose the port in the client application.
Read more about this here: http://msdn.microsoft.com/en-us/library/ms181087.aspx