dzibul
dzibul

Reputation: 622

Connecting to SQL Server db through TADOConnection

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?

Upvotes: 0

Views: 3205

Answers (2)

Celal Ergün
Celal Ergün

Reputation: 985

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.

Upvotes: 1

Darian Miller
Darian Miller

Reputation: 8088

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

Upvotes: 1

Related Questions