Localdb in Visual Studio 2015 error 52 (SQL Server) - sql-server

I programmed an application with an attached .mdf database file that works fine on my computer. But on another computer (client PC) I get this error message :
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: SQL
Network Interfaces, error: 52 - Unable to locate a Local Database
Runtime installation. Verify that SQL Server Express is properly
installed and that the Local Database Runtime feature is enabled.)]
System.Data.SqlClient.SqlInternalConnection
Should I install SQL Server Express on my client PC? It's just impossible, can you please help ?
Thanks in advance

If you want to use a .mdf SQL Server database file, you must install at least SQL Server Express on that machine - or put the database on a SQL Server instance in the network the PC is connected to and use the database on the server.
You cannot use a .mdf database file totally without installed SQL Server - SQL Server is not an embedded database that works without installation. If you require such a database, look at SQLite, SQL Server CE (Compact Edition) or something like RavenDB. Those can be embedded (as a set of DLL's) into your solution and work against files on disk without need of installing a server component on the machine where they run.

Related

SQL Server connection error when trying to import from another DB on server

SQL Server 2014 Express is installed on a VM Windows Server 2016. There are several databases attached and when trying to import a table from one DB into another on the same server, I got the following error message:
Login timeout expired
A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. (Microsoft SQL Server Native Client 11.0)
I can log onto SQL Server and run queries as per normal which includes joining tables from different databases but just can't export/import data within SQL Server using the import/export data wizard.
I have double checked that the server name is spelt correctly.
The export/import wizard has been working fine until about a week ago and there have not been any changes made to the configuration.
When trying to troubleshoot I tried to find the SQL Server Browser service in the SQL Server configuration manager was unable to. Not sure if this is relevant there is also SQL Server 2016 installed on the same VM and I do not see the SQL Server Browser server for this either but the Export/Import Wizard runs OK between the various databases on SQL Server 2016
Many thanks

No instance created by SQL Server 2008 R2

I have a problem with SQL Server 2008 R2, when I try to connect to server it gives me the following message:
TITLE: Connect to Server
Cannot connect to (local).
ADDITIONAL INFORMATION:
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 found a couple of solutions for this, one of which told me to go the configuration manager and check the instance created by SQL Server. There was none. I found only this:
I need to learn SQL Server for a job, and I don't know what to do.
-- UPDATE --
I reinstalled SQL Server 2008 and some errors might have something to do with my issue..
errors in reinstalling
note: the first time I installed I was basically clueless, I might had the same errors before and I simply didn't notice..
This seems you only install SQL Server Management studio not whole SQL Server DBMS so you need to install SQL Server and then try again.To check that SQL Server is installed on my PC or not You can follow these Steps
1.In Window Run Type `services.msc`
2.Check that SQL Server Service is present or not
3.If Present Then Check in Running Mode or not.
4.if not here still SQL Server is not installed
Hope this helps you
You need to install SQL server and SQL Server studio management tool. Seems you are trying to install SQL Server 2008.
Go to this link and download the version of SQL Server 2008 you are after
32 or 64 bit
https://www.microsoft.com/en-au/download/details.aspx?id=1695
Then install a Microsoft SQL Server 2008 Management Studio.
https://www.microsoft.com/en-au/download/details.aspx?id=7593
If you have windows 8.1 and upwards you can install the newer version of MSSQL which comes with Management studio. https://www.microsoft.com/en-us/sql-server/sql-server-downloads.

Visual Studio Enterprise 2015 installed - is SQL Server included?

I have Visual Studio Enterprise 2015 installed (on Windows 10) and need access to SQL Server. I thought the server was included in the installation of VS, but begin to suspect that I was wrong.
I can see programs under Control panel, like SQL Server 2012 Native Client, SQL Server Express 2014 Localdb, some different management tools, etc.
I concluded that the SQL server and management tools were integrated, but can not run the server via my VS:
Can not connect to ... A network-related or instance-specific error ocurred 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 configurated to allow remote connections. (provider: Named Pipes Provider, Error: 40 – could not open a connection to SQL-Server) (Microsoft SQL Server, Error 2 ... Unable to find the file.
I realized that I need to configure the firewall in some way, perhaps even make further adjustments/configurations. But I also think that I still have to install? How do I make these configurations?
Do I need both the SQL Server and Management? Or is it enough with the VS for management? If installation is needed, does it matter which version I choose? (I have access to DreamSpark: Web Edition, Express, ordinary etc. - 2014 and 2016). As you can tell I am a total beginner and need some help to point me in the right direction…

Launching SQL Server 2008 Express from VS2010 in SQL Server Management Studio

My laptop has Windows 7, x64 bit, and was built this past December (2 months ago). It has Microsoft Visual Studio 2010 installed with SQL Server 2008 Express, but I had not used "Sql2008" before on this PC.
SQL Server Management Studio has been installed all that time, and I use it to connect to our company's instance of SQL Server.
Now, I need to do some development and debugging on a large stored procedure that is not returning the data we expect. I got a backup of the database companyDB.bak and moved that to my Win7x64 laptop in this folder: C:\Temp\companyDB.bak.
I open SQL Server Management Studio and select (local) and click "Connect":
After some time, I get error message:
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 do some research and found this helpful link: SQL SERVER – FIX : ERROR : (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: )
His first step is to make sure SQL Server is running, which it seems to be:
Next, it says to make sure I am using TCP/IP Port 1433. When I looked, it seemed all of mine were BLANK, so I changed them so that all use Port 1433, then Stopped and Restarted the service:
OK, now I can get my local instance to start up.
When I attempted to restore the database using my "companyDB.bak" file, I get an error saying the database I am restoring from is newer than I am saving it to:
System.Data.SqlClient.SqlError: The database was backed up on a server running version 10.50.1600. That version is incompatible with this server, which is running version 10.00.2531. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.Smo)
So, I downloaded SQLEXPRWT_x64_ENU.exe from here: from here: http://www.microsoft.com/en-us/download/details.aspx?id=30438
During installation, I get this error saying that it can't install until **SQL Server 2005 Express Tools" are removed:
Now below, if you will notice, I did a search of the items installed under my computer, and the only thing there is with "2005" in the title is VC++ 2005 Redistributable:
So, I cancelled the installation and started it again, this time selecting the "Upgrade from SQL Server 2000, SQL Server 2005 or SQL Server 2008" option, but I got the same error message.
I do not seem to be able to continue.
Obviously, some of my installed applications need VC++ 2005 Redistributable, or I would not have installed it a few months ago.
How do I proceed?
[UPDATE]:
Following Davide Mauri's SQL Server 2008 R2 Installation and the Phantom of SQL Server 2005 Express blog, I searched for the term Sql2005SsmsExpressFacet in the log file "C:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\yyyymmdd_hhmmss\Detail.txt".
It only pointed to a single registry entry (where his pointed at two): ""
Init rule target object: Microsoft.SqlServer.Configuration.SetupExtension.Sql2005SsmsExpressFacet
Sco: Attempting to create base registry key HKEY_LOCAL_MACHINE, machine
Sco: Attempting to open registry subkey
Sco: Attempting to open registry subkey SOFTWARE\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM
Rule 'Sql2005SsmsExpressFacet' detection result: SQL 2005 Ssms EE installed=True
Evaluating rule : Sql2005SsmsExpressFacet
Rule running on machine: 5000-C6E8-1
Rule evaluation done : Failed
Rule evaluation message: The SQL Server 2005 Express Tools are installed. To continue, remove the SQL Server 2005 Express Tools.
But, my registry does not even HAVE that directory:
[UPDATE 2]:
OK, so our IT guy has given me the full blown SQL Server 2008 R2 CD to install, but I am still hitting this same roadblock with it thinking that SQL Server 2005 Express tools are still installed - so I can not move forward.
To fix this, I did the following:
Uninstall all of the SQL Management Studio instances I had
reboot
Install SQL Server 2008 (not the Express version)
reboot
Tada!
I guess Microsoft likes selling their product, and it worked.

Can't attach database to SQL Server Enterprise, needs Express?

I already have SQL Server Enterprise 2012 on my PC and the service that is running is MSSSQLSERVER (found on SQL Server Configuration manager).
I am trying to attach a database which requires SQL Server Express!
I downloaded SQLEXPR_x64_ENU and installed it, unfortunately SQLEXPRESS is not shown in my Configuration manager.
What shall I do to attach this database?
The attempts I've done:
First I tried with SQL Server Management Studio: while attaching gives this problem message:
An error occurred when attaching the database(s). Click the hyperlink in the message column for details.
and the progress box shows:
Error occurred.
While I try to add a data connection to the database in VS2012 I receive these errors:
If I use Data Source "Microsoft SQL Server" I receive this message:
The user instance login flag is not supported on this version of SQL Server. The connection will be closed.
If I use Data Source "Microsoft SQL Server Database File" and I browse the database file, I get this error message:
A network related or instance specific error occurred while establishing oa 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: Sql network interface, error 52 - unable to locate a local database runtime installation. verify that SQL Server Express is properly installed ant that the local database runtime feature is enabled)
As you see SQL Server Express is required.
If you correctly installed SQL Express on a laptop that already had the MSDN developer version, you should see two instances in the services.
MSSQLSERVER - developer version
SQLEXPRESS - express version
SQL Express does not come with services like the SQL Server agent. But it should be listed as the database engine SQL SERVER (SQLEXPRESS) under the configuration manager, SQL Server Services.
Make sure this service is started as well as the Browser service. Under network configuration, make sure TCP/IP is enabled. Under client protocols make sure TCP/IP is enabled.
Since you have the development version of SQL Server, you can connect and manager the express instance like the default instance. Just use your SSMS query window with the correct TSQL.
Here is a link on my blog on how to create a database for attach.
http://craftydba.com/?p=1753
Please respond back if you still have issues with a screen shot or two of the settings I just discussed.

Resources