0

My database is on server that I connect to through a VPN tunnel. When I try to connect through SQL Server Management Studio, I do not have problem. When I try to connect with this Delphi component I get the message:

Login failed for user . The user is not associated with a trusted SQL connection.

although in my connection string I have the user and password. Can anyone help?

8
  • 2
    Have you seen this article ? Commented Mar 25, 2013 at 11:22
  • 2
    @TLama that article is about server options, but Management Studio connects sucessfuly, so there is something with ADO connection options. @dzibul try to create UDL connection file and check connection with it. After that copy connection string into your app. Commented Mar 25, 2013 at 12:28
  • 1
    @JanDoggen the component is TADOConnection (mentioned in the header) Commented Mar 25, 2013 at 12:35
  • 1
    @teran - if SQL is not setup for mixed mode then you will get this problem. (Studio uses windows authentication by default, if you specify username & password in the connection, standard authentication must be enabled on the server) Commented Mar 25, 2013 at 12:38
  • 1
    You could try to connect a network drive on the remoteserver to have an authentication if you are using SQL Server Authentication. Commented Mar 25, 2013 at 13:45

2 Answers 2

1

There's not quite enough in your question to answer with full confidence, but force your ADO connection string to utilize Windows Authentication:

Network Library=DBMSSOCN; Integrated Security=SSPI; User Id=; Password=; Provider=SQLOLEDB.1; Initial Catalog=YourDatabaseName; Data Source=YourServerName

SSPI is for Trusted Connections - uses the current security identity of the executing process. (The logged on user credentials)

DBMSSOCN is for TCPIP

Sign up to request clarification or add additional context in comments.

Comments

1

You should configure your MSSQL first, change security mode. It is "windows only" by default. Change it to "Windows and SQL server". This way you can connect with a user name and password. Otherwise you should be logged in to a domain server to generate SSPI context.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.