Umbraco Database Connection Credentials - database

Where can I find the database credentials of my umbraco database?
In web.config there is just the following line:
<add name="umbracoDbDSN" connectionString="Data Source=|DataDirectory|\Umbraco.sdf;Flush Interval=1;" providerName="System.Data.SqlServerCe.4.0" />
Which provides insufficient information...

Your connection string clearly shows that you're using default SQL Server CE database (Umbraco.sdf). You can find the Umbraco.sdf file in the /App_Data folder.
Depends on your requirement you can convert the SQL Server CE database to SQL Server Express or open up your solution in Webmatrix to see database tables.
You can find more information on conversion here https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/53818-Convert-Umbraco-SQL-CE-database-to-SQL-Express
To view database tables from webmatrix, you need to open up your solution and click the tab called databases.
umbracoUser is the table where you can find users.

It seems that you are using SQL Server CE and not a SQL Server instance

Related

Can't connect to Visual Studio 2015 SQL DB using Excel?

!
I've tried using ADODB connection string and also in the Excel Data Connection Wizard.
I'm getting this error:
[DBNETLIB][ConnectionOpen(Connect()).]SQL Server does not exist or access is denied.
I can see the server created in Visual Studio with its databases fine, no worries, in SQL Server but not connect in Excel. I can connect in Excel to databases created in SQL Server but not those created in VS (2015).
It's seems like a server issue rather than database one but here's the connection string's anyway:
This works fine for database's created in SQL Server:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=DESKTOP-ODUI05F\MSSQL2012;Initial Catalog=MyDatabase
but the same string generates the above error when connecting to the server/database created in VS.
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=(LocalDB)\MSSQLLocalDB;Initial Catalog=aspnet-Widly-20160823125202
The server name is: (LocalDB)\MSSQLLocalDB.
The database is generated in VS using EF.
Please help - driving me nuts.
Thank you, Simon
Solved!
Followed the solution linked below.
Even though it's an MSSQL Server DB you're trying to connect to, using Excel Data Connection Wizard you have to ignore SQL Database connection option and choose "Other/Advanced" instead. I recorded it in a macro which produced all the vital parts for the connection string as follows:
How to connect to localDB in Excel
Provider=SQLNCLI11;
Integrated Security=SSPI;
Persist Security Info=False;
Data Source=(LocalDB)\MSSQLLocalDB;
Initial Catalog=aspnet-PTL-20160827031609
Besides doing the dishes this is my biggest and only achievement today! :)

allow to auto generate DBs in sql server under windows authentication

In my web.config I have defined following connection string for a Database that not existing in sqlexpress (code first entity framework approach)
<connectionStrings>
<add name="cityconnectionstring" connectionString="Data Source=.\sqlexpress;Initial Catalog=CityPolulation;Integrated Security=True;MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
So once I define this on web.config file I can see cityconnectionstring listed under Server Explorer window Data Conncetion in Visual Studio.
But When I trying to Right Click on above connection string and hit Refresh I'm getting following error in Visual Studio.
Server Explorer Error
server explorer unable to perform this operation see below for
details.
Cannot open database "CityPolulation" requested by the login. The
login failed. Login failed for user 'PC-name\username'.
All the answers related to above error are for existing DBs.
How to set permission that can connect to sqlserver for not existing DBs under Windows Authentication.
What are the Settings I should look in IIS or SQL server Management Studio
When the connection is verified it checks that you have access to the database. If the database does not exist then you cannot verify the connection.
If as your question's title suggests, you want to create the database, then you will still need to connect to a database first. IF you have permissions to create a database then you will certainly have access to the "master" database.
However, I hope that you are not expecting all users to be able to create a database as that would mean that all of your users have far too many permissions to the server!
EDIT Change the connection's database to "master". That will prove that you can connect.
Then manually (in SSMS or whichever tool you use) Create the new database on the server.
Now modify your connection to use the new database connection. You should now be able to connect.
Entity Framework is not capable of creating databases. However, once you have created the database it can create tables and data.

How can I set up a remote connection to a SQL Server 2012 database in the Cloud?

I have connection strings that look like this after I added a few line feeds so it's easy to read:
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=xxx.database.windows.net;
Initial Catalog=database2;
Persist Security Info=True;
User ID=xxx;
Password=yyy"
providerName="System.Data.SqlClient"/>
I have two tables one in a local database and one in database2. The tables are in the dbo schema.
If the table in the remote and local databases are both called USERDATA then how can I move data
from my local to remote database. I assume I need to make a remote connection but is that possible
if the database is store in the cloud like this? If possible can someone tell me how I can set up
this remote connection? I have SQL Server Management Studio so I can open a SQL Query window. I am just not sure how to specify the remote connection and if that is the best way to do it.
You can use like this:
INSERT INTO [database2].[dbo].[USERDATA]
SELECT tn.ID, tn.NAME
FROM [database].[dbo].[USERDATA] as tn
or you can use SSDT (Sql Server Data Tools) to migrate your schema and data to Sql Database on Azure.
There are multiple ways of handling this. Two simple ones of the top of my head are:
1) If you just need to transfer data for ONE table your best bet is to use a program called 'bcp' that comes with your SQL Server tools.
bcp allows you to export or import data (using in or out parameters) to a file and very quickly. You can simply use the bcp tool, export a table into a flat file, copy it over to the SQL Server in the cloud (using remote deskop or sharing the file in Azure storage or any other web-based storage) and then import the table again.
2) Alternatively, if you have access to SQL server in the cloud from your premise machine (ie: the firewall is open) and you're to run SSIS, you can connect both of the SQL servers within your SSIS package and transfer the data via SSIS

SQL Server Connection

We have an Excel file from which it retrieves information from a SQL Server DB.
Here is a snippet of the code:
Provider=SQLOLEDB.1;Persist Security Info=True;User ID=mjone;Initial Catalog=pff_db;Data Source=....
My question is that for mjone, how is he able to get connected to the SQL Server DB? I am looking at the SQL Server Management Studio and do not see any mjone used.
Check these:
Check the users under `pff_db`
Check global SQL Server Users
Check if that user exists in the server (Windows)

SQL Server - Database 'Database' does not exist. Make sure that the name is entered correctly

I'm trying to generate my database tables from my Entity Framework model, but I'm getting this error when I execute the generation query:
Database 'Database' does not exist. Make sure that the name is entered correctly.
I'm able to connect to the local server just fine.
My connection string, which was generated by VS when I selected 'Database.mdf':
metadata=res://*/Models.Models.csdl|res://*/Models.Models.ssdl|res://*/Models.Models.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
The database definitely exists, but I've noticed that the only databases it's picking up on the server are called master, model, msdb and tempdb.
Can anyone help?
Edit: I've just realised that the SQL connection dialog that comes up when you click "Execute SQL" allows you to connect to a server. But my DB isn't on a server, it's just a user instance database. But that's the only option, so how would I execute against my database? I have the database open in the 'Server Explorer'.
The connection string is referring to a user instance database is that what you intended? I got the impression possibly not from the question.
If not try changing it to Data Source=ServerName\InstanceName;Initial Catalog=Database;Integrated Security=True;
If you are using a user instance database, specify the full path to the location of the database with USE directive.
For example:
USE [C:\Project\Database.mdf]
GO
When connecting the server, you need to select another data source, then enter the name of the local server on which the database is located.
I can't speak for Entity Framework, but within SQL, "database" is a (very) reserved word. Try calling your database (and it's files) something else, even if just "MyDatabase".
I faced such problem when running a script in SQL Server Management Studio to do some stuff on my Local SQL Server. I noticed that the Query Window that I was running the script in was connected to a Remote SQL Server not my local machine.

Resources