Can't save database default locations in SQL Server - sql

I'm trying to change the default directories for data and logs using SQL Server Management Studio. I change the path then click ok but it always reverts back to the old directory in Program Files. Anyone else seen this bug? I'm using SQL Server 2012 Standard.
I do see that the correct values are saved in the registry, but they aren't being obeyed by the studio or other connecting applications that would create new databases.

According to Microsoft, you must restart the SQL Server service for this to take effect.
You can do this easily via the Configuration Manager, or via the services.msc snap-in if you prefer that.

Related

Cannot connect to a MSSQL Express 2014 Database using VS 2013 Professional (specifically VB)

I read another article concerning this problem when getting the file in use message. I went into SQL Management studio and disconnected the database but still no success in connecting. Here's what's happening step by step:
I downloaded SQL Express 2014 and installed it. I created a DB called MyEntertainmentDB, then created a couple of files (Movies and Rating). I added some data to both. I fired up VS and in VB I created a form added various controls including a datagrid. The DB exists in the default location used by MS SQL. I clicked the Smart Tag and the data grid view tasks window appears. I click the choose data source drop down arrow and then add project data source. Database is highlighted and I click next. Dataset is highlighted and I click next. Now I click new connection and select Microsoft SQL Server Database File (Data provider is .NET Framework Data Provider for SQL Server (the only thing in that drop down box)) and I click Continue. Now I'm shown a window that has the data source as Microsoft SQL Server Database File (SqlClient) in the first box and I browse to where my database is located and select it (which is C:\Program Files\Microsoft SQL Server\MSSQL12.SQLEXPRESS\MSSQL\DATA\MyEntertainmentDB.mdf). Everything is going well and I'm using Windows Authentication. I click ok. Now it waits several minutes and I get this message:
The attempt to attach to the database failed with the following 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 the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 50 - Local Database Runtime error occurred. Cannot create an automatic instance. See the Windows Application event log for error details.
I looked in theSQL Server log but nothing was mentioned shedding any light. I could not find any VS log. I checked the windows logs but could not find anything seemingly relevant. I'm at a loss for this problem and am about ready to trash MS SQL server and just go with MS Access 2010 or MySQL. Does anybody see where I'm going wrong? If so, please help, I've tried to be very specific and hope I've provided all info necessary.
First of all you must configure your MSSQL Express Server to respond.
To do that you must open SQL Server Configuration Manager (on Windows 8.1 just go in the upper right corner, hit Search and type: SQL Server Configuration Manager. If you are using Windows 7 you can find it on Start Menu).
On SQL Config Manager you must go to expand SQL Server Network Configuration and you'll see Protocols for (your DB instance). Click on that.
After you click on Protocols for (your DB instance) in the right window you will see Shared Memory, Named Pipes and TCP/IP. Double click on each and set them to Enabled = Yes.
Now your MSSQL Server must listen to standard port 1433. To do this double click on TCP/IP, select IP Addresses (Now you will see IP1 config, IP2 config, etc), scroll down to IPAll and set TCP Dynamic Ports to 0 and TCP Port to 1433.
Now restart your SQL Server Service. If don't know how to this, just reboot your computer. After reboot open command prompt and type netstat -a to see if your MSSQL is listening on port 1433.
Now in Visual Studio when you are connecting to your SQL Server on Server Name type server IP (your IP or 127.0.0.1) or you can select your SQL Server instance from dropdown list without any problems.
You can check this tutorial too: Allow SQL Server Express to accept remote connections
Alright, I finally solved the problem and not in a way people would think. First off, I want to thank everyone who responded with the intelligent answers, but we were off base on this one and I'm not sure why, but your responses ultimately led to my defeating this problem. I've been wrestling with this problem for the last 3 days almost exclusively - I don't like being beaten - and 1 entire night. I've uninstalled and re-installed several times and even got superstitious and waved a chicken bone - lol - at it but nothing worked! I've asked this question on several web sites and finally I went to a link that stated the .msi file was included with MS SQL Server 2012 Management objects I and was hesitant to download as they pertained to the 2012 version. So after tinkering to no avail I downloaded the 2012 CLR Types and Management Objects and looked in the Windows\assemblies folder and still no v 11. But I guess 2012 installation installed them in Program Files (x86)\Microsoft SQL Server\110\SDK\assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll v11.0.2100.60. I ran VS 2013 and added the data source. After going through all this problem I'm wondering why Microsoft invents all these places to put things when one would work. Every version of windows from 3 to present has always been totally revised and I wonder for what. Improvements are okay but quit reinventing the wheel. Without your help I might not have ever found the solution and perhaps would have been an oracle or mysql guru or not. Your the men. Thanks all.
Do not connect to mdf, connect to the SQL Server and use MyEntertainmentDB database from there.
The MDF file is locked by the SQL Server for reading/writing data.

Microsoft SQL Server 2012 no database engines

I just installed MS SQL Server 2012 (Express). I went through the whole install process from SQLManagementStudio_x64_ENU.exe (other things were already installed) with checking all the checkboxes, so I thought I had everything necessary.
When I try to connect to .\sqlexpress, I get a message saying "Cannot connect to .\sqlexpress". See below for message detail, I copied it from another question because mine is in Dutch :-)
Cannot connect to .\sqlexpress
I did some research through my friends Google and Stackoverflow, but none of the solutions work.
1. There is nothing in Database Engine -> Local Server Groups -> Register Local Servers (it says "No local servers of type "Database Engine" were found"
2. I cannot restart the services as I only have one "SQL related" service (SQL Server VSS Writer)
3. There are no services listed in Sql Server Configuration Manager -> SQL Server Services
Does anybody know what's wrong? Please let me know if you need additional details.
Thanks, a SQL Server newbie
The SQLManagementStudio_x64_ENU.exe as the name says only contains SQL Server Management Studio, which is the GUI used to manage servers. It does NOT includes any DB engine or anything else but the client tool, so it's normal that you don't have the service installed.
Look at the downloads at the official download website. The file named SQLEXPRADV_x64_ENU.exe or SQLEXPRADV_x86_ENU.exe are the full installs that includes both the client tools and database engine together. It's normally the best possible download I can think of from all the choices.
If I recall correct the file SQLManagementStudio_x64_ENU.exe only contains the management tools and not the server software. You need to download another file (SQLEXPRADV_x64_ENU.exe if you want the complete package with server and reporting services etc.).
See this page for more information
I assumed that you have completed whole installation process without any error.
It may possible that you have installed it with another instance name and possibly because of that you are getting this message.
Following thing you have to check.
Try to access on Same machine where you have installed SQL Server using Management studio.
Start menu or Search for SQL Server Configuration tool. At that tool you will find SQL server instance. name.
Make sure that your instance is running mode.
Which authentication mode you have choose during installation and take proper step during making connection
If above step will not work then please provide more detail.
You need to Download the SQL Server Express Edition with the Advanced Services option.
ADV - with advanced services (reporting services)

VB.NET Creating a local database in VS2013 or in SQL Server Management Studio

I am about to begin a personal project to build my skills in the .net environment. I am familiar with SQL Server Management Studio and how to create a database in it but I discovered how to make a local database in Visual Studio as well. My program is only going to require local database access as it will be used for individual inventory systems rather than connected ones. Am I ok to use the onboard tools in visual studio and create a local databasse or should I be using the SQL Server Management Studio?
When you use the Local Database item template in VS, it creates a SQL Server CE data file (SDF) and adds it to your project. When you use the Service-based Database item templete, it creates a SQL Server (Express) data file (MDF) and adds it to your project.
The advantage of using the VS tools is that the data file becomes part of your project and can therefore be easily deployed with the compiled application. As such, the database is basically part of the application.
If you choose SQL Server CE then you don't need a server installed on the user's local machine. They can install SQL Server CE or you can install it with your app if you want, but you also have the option of simply deploying a DLL with your app and it will work.
If you choose SQL Server Express then the user actually needs a SQL Server instance installed on their machine. To be honest, I'm not 100% sure whether that instance must be SQL Server Express or it can be a full SQL Server instance too. It would usually be SQL Server Express though, which you can install and even download automatically when you install your app, depending on the deployment method you choose.
If you use the VS tools to create an MDF data file then your connection string will contain the Data Source and AttachDbFilename attributes. The Data Source will generally be ".\SQLExpress", i.e. an instance named "SQLExpress" on the local machine. That instance name is not required, although it is the default for SQL Server Express, but it must be on the local machine. The MDF file gets attached at run time and detached again when you're app is done with it. It will also usually be attached to a user instance, which means that other users can't see it, even when it's attached. Note that, in later versions, the LocalDB feature of SQL Server may also be utilised.
If you create your database in Management Studio then it's not actually part of your app. It will be permanently attached to the SQL Server instance so, everyone will be able to see it and open it, assuming permissions allow. Creating the database during deployment will be an extra step in that case. You might create a backup and restore that during deployment or generate SQL scripts that get run. In this case, your connection string will contain the Initial Catalog attribute to specify the name of database to connect to, as well as the Data Source attribute. This option is required if you want multiple clients to be able to connect to the database.
In short, if you are only going to be accessing a database from the local instance of the one application then creating a database in VS is OK and probably a good idea. Whether you choose SQL Server CE or SQL Server Express may well depend on what level of functionality you need.

Default server name for Microsoft SQL Server Management Studio 2012

I wanted to use Microsoft SQL Server and thereby installed a fresh copy of Microsoft SQL Server Management Studio 2012. It was an automatic installation and did not ask me for a server name. Right now, I'm stuck at the login screen and not sure what to put as the server name.
I happened to refer few previously posted questions and tried using ".\SQLExpress" as the Server Name, but the following error was displayed
What could be the possible Server Name ?
PS: The system name is "CBEUG".
SQL Management Studio is just that - the management studio tools. It is not the SQL Server itself. For that, you will need to install the SQL Server package.
If you can't see a SQL Server services in Services, it is not installed.
In the Server Name field (where you type the server name) you also have a scroll box with "Browse database..." (or something like that according to the version). That's where all of your databases are so you don't have to remember their names.
Good luck!
Well I was facing same issue and when i have done something like this
Server name : "your computer user name"\SQLExpress
and use your user name and password that you have given while installing the SQL studio.
it will work.
By default it takes the name of the computer
say if the computer name is B,then enter B as server's name with windows authentication

FTP Database to webhost server

I have written an asp.net mvc application that is connected to a Microsoft SQL Server Management Studio database and I want to deploy the application to the webhosting server now. I have managed to get the published code onto the server easily. However, I want to ftp the database I created in Microsoft SQL Server Management Studio to the server. Where are these created databases saved and is it possible to ftp the database to the server. The other issue is the web hosting server is using MS SQL Server Express is that a problem?
Normally shared hosts expect you to place the database in the App_Data folder and use it directly from there.
Here is a page to explain connecting to the database
http://msdn.microsoft.com/en-us/library/ms247257.aspx
To find the database on your system open sql management studio right click the Database and click Properties on the Properties windows click on the Files section to show all associated files with your database.
I would recommend checking your providers documentaion though they might have specific requirments for database deployments