Set connection string for SQL Server in Plesk for aspnet core application (this is not a true question but a explanation on how to do it) - connection-string

I was trying to set this parameter and was having difficulty with it.
In the Plesk database section i had the database i wanted to use. First i had to make a dump of the database i was using locally with my aspnet core project. I used SQL Management studio to access the database on the SqlExpress Server, that is the one that is installed with visual studio and the one that is used by default when creating a application with user login template. The sqlExpress server name is (localdb)\MSSQLLocalDB.
Still on the SqlManagment studio, i selected the database, right-mouse click, Tasks, dump database.
On the plesk management area, on the database sections, i made a import of that file for the specific database i wanted to use. Then clicked the check button and it was ok.
Then the hardest part was to figure out what connection string to use, and even, what is the name of the server?
Solution in answer.

On the Plesk database area, on the specific database there is a "Connection info" which gives us the following info:
Host ------------------- .\MSSQLSERVER2019
Database name --- myspecificdb_
User name ---------- myusername
Password ----------- myPassword123+
And the connection string we should have on our appsettings.json is...
"DefaultConnection": "Data Source='.\MSSQLSERVER2019';User ID=myusername;Password=myPassword123+;"
Now, why it works without specifiyng the database name is a mistery to me. If anyone knows please feel free to explain.
So the correct way is:
"DefaultConnection": "Data Source='.\MSSQLSERVER2019';User ID=myusername;Password=myPassword123+;Database=myspecificdb_;"

Related

Oracle DB Client 19c install error -> INS-32103 Specified Oracle Home user does not match with existing Home user

I am trying to install Oracle Database Client 19c. From what I understand, if I want to connect SQL Server Management Studio to an Oracle database, I need to install this client. So I already installed the "Instant Client" without any problems. I was able to test the connection under the "ODBC -> Oracle driver"
Below are my installation steps of the Database client
select "Administrator"
For selecting a Home User, I've tried using an Existing Windows user (local user), and also I've tried "Use Windows Built-in Account"
I selected the Oracle base and software location. Then I clicked "Next" and it gives me the error about the Home User does not match with existing Home user.
Can anyone help me figure out why I am getting this error and how I can fix it? Thanks!
This can also be caused by an inventory entry still existing for the oracle home, especially if you are installing/deinstalling on the same machine. To test for that, use a different home and try the install, anything that will not match the previous home. I was testing my install process so I just ended up deleting the inventory files from C:\program files(x86)\Oracle, but you can also detach the home.

Where to find localdb created?

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?

SQL Server 2012 SSDT "The project could not be deployed to .... A connection cannot be made ...."

I'm a newbie to SQL Server 2012. Here is my condition.
I have a running SQL Server 2012 Business Intelligence SP1. The problem is I cannot deploy a project to my SSAS from another computer.
The error is:
The project could not be deployed to the 'DATABASE-SERVER\MSSQLSERVER' server because of the following connectivity problems : A connection cannot be made to redirector. Ensure that 'SQL Browser' service is running. To verify or update the name of the target server, right-click on the project in Solution Explorer, select Project Properties, click on the Deployment tab, and then enter the name of the server.
The following is the things that I've tried:
Check the target name on Project > Properties > Deployment > Target server.
Check the server service --> all SQL Server services are running.
The project can be deployed from server.
The connection to server is clear
I can connect to the Database Engine and Analysis Service from another computer from SQL Server Management Studio.
Please help me to fix this problem, I've been search for many days for this problem.
Thank you, sorry for my bad english.
Best regards, Stella.
I had the same problem, for me the solution was to explicitly specify login information on the Impersonation Information tab on the Data Source.
I know this is an old thread, but I had the same issue and I reckon more will run into this buzz saw.
My problem was that the remote installation of SSAS did not have an Inbound firewall rule for SSAS application; msmdsrv.exe.
Resolution:
Log on to the server running SSAS as Administrator
Launch Windows Firewall and advanced Security
Add Inbound Rule, give it a meaningful name like SQL Server - SSAS
Action: Allow the connection
On Program and Services Tab: For 'This Program' use Browse and identify msmdsrv.exe
For SQL Server 2014, it is by default here:
%ProgramFiles%\Microsoft SQL Server\MSAS12.SQLSVR14\OLAP\bin\msmdsrv.exe
(Very similar for 2012 and 2016, the numbers are different)
Click OK; You should see a green dot with check mark
Try your project again; It should connect, did for me.
NOTE: If this also work for you, consider going back to the Inbound Rule and consider adding connection restrictions for security reasons.
I solved mine by right clicking my data source (under Data Sources in Solution Explorer) → Edit in the General tab → In Connection Manager, do two things:
Change Server name from localhost to your computer name
Use SQL Server Authentication as Authentication, as opposed to Windows Authentication, and proceed to enter your user name and password (the "sa" password you use for SSMS).

Deployment of DB TFS MSBuild

I have the following problem deploying our ASP.net Webproject. The Deployment just runs fine. I'm using TFS 2010 and deploy the application through the msbuild arguments (/p:DeployOnBuild=True etc.).
The problem I'm running into is the deployment of our database. At the moment I'm trying to use the Package/Publish SQL settings of the web project. The connection string for the destination database looks as follows
Data Source=SomeIP, 1433; Initial Catalog=MYDatabase; User ID=DeploymentUser; Password=PW;
So I'm trying to use an sql login to login to the sql server (sql server 2012, the respective user is dbowner) but every db deployment fails because msbuild always tries to login to the sql server with the buildservice account.
One solution might be to grant access to the sql server of the build account. Unfortunately this is not possible for us because the dbserver is not in our domain.
Any ideas how i can force msbuild using the sql login specified in the connection string?
Are you doing any of this:
"Import from Web.config
Finds connection strings in the Web.config file and enters their names into the Database Entries grid with "-Deployment" appended to them.
You can change the "-Deployment" suffix to "-Web.config" (for example, change "ConnectionStringName-Deployment" to "ConnectionStringName-Web.config") in order to specify that the connection string value in the Web.config file should be used for deployment. For more information, see Connection string for destination database later in this document."
and is it taking the connection string from your web.config?
http://msdn.microsoft.com/en-us/library/dd576376.aspx

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.

Resources