"Login failed for user" trying to connect to SQL Server 2012 - delphi

I'm trying to get acces to a remote SQL Server, using SDAC.
(in fact I have to get access to the remote DB from android application)
What I've done to set up is here
The configuration string of the TMSConnection is:
Password=mysaPwd;Data Source=RemoteIp;Initial Catalog=myDB;User ID=sa
What I get is : Login failed for user 'sa'
I tried to change the remote IP with local ip, starting the application locally on the server, but the error I get is the same.
I know that it's not a good way for safe reasons, but I want understand where the problem is
this is the authentication mode:
then, the connection configuration

Jerry Dodge was right!
I tried to connect to a different server instance than I intended
There was an old instance of SQL server already installed.
Unfortunately the error message was not clear as something like "User name or password is incorrect" but "Login failed for user", that lead me down the wrong path.
Thank you all!

Related

Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database

I'm using Umbraco CMS v7.4 with SQL Server 2014, the project was working fine until a few hours ago, when an error started showing up:
Umbraco cannot start. A connection string is configured but the Umbraco cannot connect to the database
The error occurs when I tried to open the website, see the image below:
I tried the following:
Checked to see if SQL Server is running
Checked the connection string credentials in web.config
Any help is appreciated.
After a few tries, even I loaded the backed up DB, I found that it caused by the DB login, the user in the connection string was having a password expiration enabled (the password had expired).
So, this is what I did:
Open the SQL server
Logged in as the user used in the connection string
Created a new password
Updated the web.config connection string "Password"
Hope this will help
So, in my case I tried to get started with the existing project. I got all the files, restored DB backup locally, made sure all permissions are set for IIS AppPool user etc. But I kept getting the error in question. It turns out that I cannot use server=localhost;database=... in connection string. After I replaced it with server=.\;database=..., it started to work right away.
Also note that if you're running it in Azure with an Azure SQL database you'll have to go to the Azure SQL Server settings and under "Firewalls and virtual networks" you'll need to tick "Yes" for "Allow Azure services and resources to access this server".
I was getting this error when running an Umbraco project locally, with the DB pointing to an instance on Azure. In that case, this problem happens if you haven't allowed the IP access within the Server Firewall of the DB in Azure.
You can fix this by finding out your IP and then adding it to the DB:
Click All Resources within your Azure portal, then click on the SQL Database your project points to.
Click Set Server Firewall on the right-side window.
Add in your IP as the start and end points, and call it something memorable.
Click Save and once you get the confirmation message that It has been applied, refresh your site locally.
I experienced the same problem and here is how I fixed it.
Right-click on your localhost in SSMS and select Properties
Got to the Security page and select "Select authentication" as "SQL Server and Windows Authentication mode"
Hit OK.
Go to Services and find your SQL Server service and restart it.
Check your local umbraco website now, you should be able to see it without any issues. If you still have problems, then you might need to check your local setup and permissions.
Further details are below and on this blog post.

Umbraco installation wizard Error - Could not connect to database

I'm trying to install Umbraco on an ASP.NET environment. After I downloaded the umbraco nuget package I tried to run the installation wizard, by building and running the project. All is fine and good, if i take the default database configuration, but if I want to customize my configuration, it fails and says :
"Could not connect to database"
I'm trying to configure it to use my local SQLExpress database, but I just cannot get it working. I have both tried putting in the server information and connecting via. a connection string, via. the wizard. It produces the same error every time.
I have made a database called umbracoblog and created an admin user, with credentials. He has dbowner etc. for the database. Besides that, I have also given full permissions to IIS_IUSRS and Network Service accounts for the project and all subdirectories, and it still doesn't work.
These are some of the connection strings I have tried:
datalayer=SqlServer;Data Source=.\SQLExpress;Initial Catalog=umbracoblog;User Id=admin;Password=********;
datalayer=SqlServer;Data Source=127.0.0.1\SQLExpress;Initial Catalog=umbracoblog;User Id=admin;Password=*******;
I have also tried putting in the connectionstring into the web.config, manually, but that just makes the project load infinitely in the browser, when I run it.
It's starting to get frustrating, that I cannot even get past the configuration of Umbraco, because it look very cool. I have tried everything I was able to found online. Have anyone gone through this and know what I need to do ?
Start again - clear out and remove the umbracoDbDSN connection string entirely from your web.config and reset the umbracoConfigurationStatus AppSetting back to empty if it has been populated.
Use the Wizard to configure the database - if it's still having problems connecting then here's a few things to check:
Check the Log file here: ~/App_Settings/Logs/UmbracoTraceLog.txt - does that show up any errors?
Make sure you can connect to the database using other clients - if Umbraco can't connect to it, chances are something else won't be able to as well.
What happens if you use Integrated Authentication? If that works, then it's most likely an issue with the username and password you specified.
The password I had for the SQL Server user had a character that the installation UI didn't accept. I changed the password to remove special characters and it was able to connect to the server again. I could successfully log in through SSMS with the previous password.

TF30063: You are not authorized to access IP

I am using below code to connect my tfs where executing machine is part of domain.
But when I try the same code in different machine (not in domain, but part of work group) getting unauthorized access error.
But in the same machine (where getting error), I am able to connect TFS with same account used in code via visual studio.
var tfsServer = new TfsConfigurationServer(
new Uri(ConfigurationManager.AppSettings["TFS_URI"]),
new NetworkCredential(
ConfigurationManager.AppSettings["TFSUserName"],
ConfigurationManager.AppSettings["TFSPassword"],
ConfigurationManager.AppSettings["Domain"]));
It's going to depend on getting the network credential specified properly. I'd suggest using Fiddler to take a look at what VS is sending and what your code is sending.

Connection between windows service and sql database

I am trying to establishing a connection between a Windows service written in C# and a SQL Server Express database. But when connection.open is called I get this exception
System.data.sqlClient.sqlexception:
{"Failed to generate a user instance of SQL Server due to a failure in
starting the process for the user instance. The connection will be
closed."}
But the same code works fine when I run it as console application.Can someone please help me with this??
_connection = new SqlConnection("Data Source=.\\MSSQLSERVER1;AttachDbFilename=D:\\vinay\\project\\LightHistorian\\LH_DB.MDF‌​;Integrated Security=True;User Instance=True;");
i gave same credentials as local system.It works a times and doesnt at some other time.But when ever this exception happens,If i restart the machine it works.Wonder what the problem is??
I have used same connection for both windows service and console application
When you execute your console application, the EXE runs under your user credentials.
When you execute your service, which are user credentials? Is your service running under Locl Service Account? Or System? Or what?
Try to manually set the credentials your service must run with (in Windows services panel, check your service properties) and try to execute it with the same user/pwd you run your console app with.
UPDATE taken from here:
Using an User Instance on a local SQL Server Express instance
The User Instance functionality creates a new SQL Server instance on the fly during connect. This works only on a local SQL Server 2005 instance and only when connecting using windows authentication over local named pipes. The purpose is to be able to create a full rights SQL Server instance to a user with limited administrative rights on the computer.
I could think that your service credentials are not granted to create a new SQL server instance, so try to remove that part.
Anyway, set user credentials on service properties and see what happens.

IPC Remoting problem

We are receiving the following error using IPC.
"Failed to connect to an IPC Port: The system cannot find the file specified."
The issue is happening on a Windows 2003 server.
Of course it only happens in production. We are unable to reproduce this in our development environment.
The Windows service that is attempting to use IPC is running as Local System.
Is there some sort of permission that needs to be changed?
We were attempting to access the channel before it was spun up. So we would receive the 'not found' error. Wrapping the access code in some 'is it really ready' code fixed the problem.
For me DTA was working fine. But Suddenly I started getting this same error.
For me the fix was this:
-> Go To Task Manager
-> Go To Processes Tab
-> Find and kill the DTA process. For me this process is named as 'DTASHELL.exe'
Now try to launch DTA. It should work now :-)
We had this problem in production code. It was failing on a small percentage of user's systems.
The error turns out to be in the microsoft code that we were using. It generates the IPC channel using the username.
ipc://APP_USER_000:SingeInstanceIPCChannel/SingleInstanceApplicationService
with certain characters in the username, this generates an invalid channel URL, so the receiving app fails to create the channel in the first place.
our fix is to use a hash of the username, rather than the first characters in the username.
(we were using the code here: http://blogs.microsoft.co.il/blogs/arik/archive/2010/05/28/wpf-single-instance-application.aspx )
Please post the code you use to initialize the server channel and publish the object, and the client code with the uri you use when you try to access the remote object.
A common pitfall is when you initialize the channel with a dictionary, and set the name of the channel using
dic["name"] = "channelName";
//used for retrieving the channel - ChannelServices.GetChannel("channelName");
instead of
dic["portName"] = "channelName";
//used as the identifier for the named pipe -
//The client should get the object from the uri : ipc://channelName/objectName

Resources