Vladimir
Vladimir

Reputation: 87

Error connecting to MS SQL LocalDB through FireDac (Delphi)

Connection parameters:

Server=(LocalDb)\MSSQLLocalDB
DriverID=MSSQL
ODBCAdvanced=AttachDbFileName=C:\Dir\Dir\TestDB.mdf

connect is successful.

Requests like FDConnection.ExecSQLScalar('SELECT ....') - work well Requets through TFDScript - work well

but running TFDQuery generates the following error:

[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0][SQL Server]Could not find server 'C:\Dir\Dir\TestDB' in sys.servers.
Verify that the correct server name was specified. 
If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

Upvotes: 2

Views: 1243

Answers (1)

mano
mano

Reputation: 36

Just add Database=any_name to connection string.

Server=(LocalDb)\MSSQLLocalDB
DriverID=MSSQL
ODBCAdvanced=AttachDbFileName=C:\Dir\Dir\TestDB.mdf
Database=MyDatabase

Upvotes: 2

Related Questions