Where to find localdb created? - sql-server

Currently I was going through Microsoft's ASP.NET Core MVC tutorial and it came to a point where I created a database context class, coming complete with a connection string that I add during the config.
Problem is however, when I check with SQL Server Management Studio, I cannot find the database created; I've logged on to both my local host as well as my PC name (for Windows auth) but the database created doesn't exist on either servers.
MS stated in their docs that when I run the command Update-Database in the PMC it would create it but I cant find it anywhere. I've tried using the name of the server from the connection string (localdb) but I cannot connect because SSMS doesn't recognize the instance.
Any idea why it doesn't show up on the studio but seems to work fine during the application running?
Connection string as follows:
"MvcMovieContext": "Server=(localdb)\\mssqllocaldb;Database=MvcMovieContext-1;Trusted_Connection=True;MultipleActiveResultSets=true"

About the LocalDB location, please, take a look here:
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/sql-server-express-localdb?view=sql-server-ver15#:~:text=User%20database%20files%20are%20stored,add%20tables%20in%20Visual%20Studio.
Your LocalDB should be located on C:\Users\<user>\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\mssqllocaldb, assuming mssqllocaldb is your instance name, based on the connection strig you have provided.
Also, to connect to your LocalDB, follow the answers given on this post, I guess could be helpful on your case:
How to connect to LocalDB in Visual Studio Server Explorer?

Related

Connect to Server in SMSS 2017 on Virtual Machine

Need some help understanding how to connect to Sql Management Server Studios 2017 from my Azure Virtual Machine.
I thought I just enter my Computer (VM-computer name) in server name, see picture below, but I get the error saying: The server was not found or is not accesible. Do I need to configure it to allow remote access? Am lost and have tried googling without result, any easy step-by-step guides?
pic of login
You can use your server name in "servername" or . and the connect. If still not connecting do check whether it is named instances running in SQL Server Configuration Manager. If it is running with named instance you need to provide "Servername\namedinstancename" in server name
I did not have any sql installed, only the SSMS..........rookie move.

SQL Server 2008 R2 can't connect to local database in Management Studio

I am using SQL Server 2008 R2 Express.
I first installed SQL Server 2008 R2 Express Management Studio and then I installed SQL Server 2008 R2 Express. I have the instance SQLEXPRESS running and it is set to automatic.
I am trying to connect to it locally using Windows authentication - server name is set to local and the username is grayed out and set to my profile username.
When I try to connect I get the following error:
Have I installed the wrong SQL Server Management Studio?
If your instance is called SQLEXPRESS, then you need to use .\SQLEXPRESS or (local)\SQLEXPRESS or yourMachineName\SQLEXPRESS as your server name - if you have a named instance, you need to specify that name of the instance in your server name.
Your "SQL Server Browser" service has to be started too.
Browse to Computer Management > Services.
Find find "SQL Server Browser"
set it to Automatic
and also Manually start it (2)
Hope it helps.
Follow these steps to connect with SQL Server 2008 r2 (windows authentication)
Step 1: Goto Control Panel --> Administrator Tools --> Services
select SQL SERVER (MSSQLSERVER) and double click on it
Step 2:
Click on start Service
Step 3:
Now login to SQL server with Windows authentication
and use user name : (local)
Enjoy ...
I also received this error when the service stopped. Here's another path to start your service...
Search for "Services" in you start menu like so and click on it:
Find the service for the instance you need started and select it
(shown below)
Click start (shown below)
Note: As Kenan stated, if your services Startup Type is not set to Automatic, then you probably want to double click on the service and set it to Automatic.
I know, this problem can be faced by so many people and many of them have uninstalled and re-installed the sql server for resolving this issue.
In my observation the problem of not connecting the database service locally is just because of your network connection you are using, in most of the cases these problems will come when you are using wi-fi network.
Solution is, if you are using wi-fi then just right click on status of the network and get the ip details and enter the same ip in sql server name,
it will work.
Regards
Vishwajeet
I have the same error but with different case. Let me quote the solution from here:
Luckly I also have the same set up on my desktop. I have installed
first default instance and then Sql Express. Everything is fine for
me for several days. Then I tried connecting the way you trying, i.e
with MachineName\MsSqlServer to default instance and I got exctaly the
same error.
So the solution is when you trying to connect to default instance you
don't need to provide instance name.(well this is something puzzled
me, why it is failing when we are giving instance name when it is a
default instance? Is it some bug, don't know)
Just try with - PC-NAME and everything will be fine. PC-NAME is the
MSSQLServer instance.
Edit : Well after reading your question again I realized that you are
not aware of the fact that MSSQLSERVER is the default instance of Sql
Server. And for connecting to default instance (MSSQLSERVER) you
don't need to provide the instance name in connection string. The
"MachineName" is itself means "MachineName\MSSQLSERVER".
Lots of the above helped for me, plus the accepted answer, but since I was on an EC2 instance, I had no idea what my instance name was. Finally, I opened SQLServer Configuration Manager and in the Name column, use whatever is there as your connection server, so in my case, .\EC2SQLEXPRESS and worked great!
Okay so there might be various reasons behind Sql Server Management Studio's(SSMS) above behaviour:
1.It seems that if our SSMS hasn't been opened for quite some while, the OS puts it to sleep.The solution is to manually activate our SQL server as shown below:
Go to Computer Management-->Services and Applications-->Services. As you see that the status of this service is currently blank which means that it has stopped.
Double click the SQL Server option and a wizard box will popup as shown below.Set the startup type to "Automatic" and click on the start button which will start our SQL service.
Now check the status of your SQL Server. It will display as "Running".
Also you need to check that other associated services which are also required by our SQL Server to fully function are also up and running such as SQL Server Browser,SQL Server Agent,etc.
2.The second reason could be due to incorrect credentials entered.So enter in the correct credentials.
3.If you happen to forget your credentials then follow the below steps:
First what you could do is sign in using "Windows Authentication" instead of "SQL Server Authentication".This will work only if you are logged in as administrator.
Second case what if you forget your local server name? No issues simply use "." instead of your server name and it should work.
NOTE: This will only work for local server and not for remote server.To connect to a remote server you need to have an I.P. address of your remote server.
I had this problem. My solution is: change same password of other in windowns. Restart Service (check logon in tab Service SQL).

Named Pipes error in SQL Server 2008 and Visual Studio 2010

I just want to connect to the local server manually. I right clicked on the "Data Connections" button in "Server Explorer", and then selected "Create New SQL Server Database". But Named Pipes provided error occured. I tried every suggested solution on the internet. Changed SQL Server Network Configuration, opened the port 1433 as told me. Restarted computer, reinstalled everything, but no, it just doesn't work.
Here you can see possible errors;
MSDN Named Pipes Provider
In my situation xxx=2. I thought i don't need connection string because i'm connecting manually without code or something. And also when i open a DB project or Server Project in visual studio i still can't make them work. Are there any suggestions? And i know there are other questions similar but they don't solve my problem.
i'm connecting manually without code or something
I assume this means you're trying to connect through Management Studio?
Why not use the server name 'localhost\myInstance' and see if you can connect that way?
Have you checked the connection string when you connect via Management Studio? If you're connecting to a default instance, make sure you're not including \MSSQLSERVER on the end of the server name. If you named your instance when installing make sure you're using that.
Have you checked that Named Pipes is enabled for this instance in Config Manager -> Network Configuration?
Have you checked the SQL Server service is running?

Application Login not working unless Windows Authentication works in SQL Server

I have a database set up that is to gather planned vacation time that I need to put on sharepoint asap. It's completely done, except for that the application login is failing for anyone that tries to use it that does not have their corprate login (windows authentication) listed in the security logins folder.
The connection string is fine, as it works properly on my computer and another programmer's computer, but not on my boss's computer. I can also login to sql server using the application login that is listed in the connection string.
I'm using SQL Server Managment Studio 2008, the server is 2005.
Edit#1: Further research led to finding this page: http://sql-articles.com/articles/troubleshooting/troubleshooting-login-failed-error-18456/
And my error is state 11. It's listing a windows authentication in the error log even though I specified otherwise.
Edit#2: My Connection String is this:
Driver={SQL Server};Server=ServerName\ThingIdontUnderstand;Database=ReportingDevDB;Trusted_Connection=FALSE;uid=Derp;pwd=qwerty;
Edit#3: Solved! See comments on this post for answers since I can't answer my own questions yet.
You check for the version when you connect to the instance through SSMS it will show it beside the server name under Object Explorer. Or just use the query SELECT ##VERSION
I would suggest simply creating a corporate windows group and adding those individuals to it, and then simply add this group as a login to your instance of SQL Server.

Creating a database through Server Explorer in Visual Studio 2010

So, I am using Visual Studio 2010 and was trying to create a new database that I could use in my project. I have vague idea of having used the Server Explorer in the past, although I'm not that sure about it. My experience with MSSQL is almost non-existent, anyway.
I don't remember having to configure anything, but it seems I have a server called Xyz already set up, as can be seen in the next picture:
I've tried to to create a new database, but I am getting the following error:
What might be wrong? What tools should I make sure are correctly running? Isn't there something like Oracle's Sql Developer which allows me easily to inspect what's happening with my databases?
Also, what about the authentication? I can't recall having configured anything when installing Visual Studio. Maybe I still have to configure something?
I'm quite lost here, I'd appreciate some light shed up on me on this issue. Thanks!
Sounds like you don't have a SQL server or you're lacking some permissions.
On the server go Start->Run and type in services.msc and look to see if you have the SQL Server process and it is running. Also verify it is not a named instance.
If you see "SQL Server (MSSQLSERVER)" it is a default instance and you should be able to reference it using the server name.
If you see "SQL Server (SomethingElse)" you have to reference it using servername\SomethingElse
You also need to verify you have named pipes enabled by running the SQL Server Configuration Manager -> SQL Server Network Configuration -> Client Protocols.
If the sql server is new, it is probably because named pipes isn't enabled.
Or it could be like Mrchief stated and you don't have permissions to access that server.
Actually I think you would get a permissions error if that was the case. Your error is specific to connecting to the sql box.
I had similar problem with the same set up.
This article helped: http://support.microsoft.com/kb/823938
It turns out that SQL Server 2008 is shipped with TSP/IP disabled by default and nobody can connect to it via network, even from localhost.
Here is the solution:
You can check in registry this key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer\SuperSocketNetLib\Tcp\Enabled
It must be set to 1 for SQL Server to be listening for network connection.
If it is set to 0, change it to 1 and restart SQLSERVER service.
Run this on master database to see error log on the server:
exec Go Xp_readerrorlog
You should look for
SQL server listening on X.X.X.X: Y
This will be an indicator if network connections are allowed in the Server

Resources