Reputation: 21
Delphi XE Tokio / SQL Server 2017 Express
I am trying to connect an application developed in Delphi with a SQL Server database, before we did it with ADO and it worked very well, but now our client requests to use dbExpress.
When trying to make the connection I get the famous error:
DBX Error: Driver could not be initialized.
Client library may be missing, not installed properly, of the wrong version, or the driver may be missing from the system path ...
I have already tried to solve the solutions I found on this topic.
Absolutely no option has worked for me, it keeps getting the error in the instruction (SQLConnection.Connected: = true;
).
I have read this and it does not work either. Delphi DBX and MySQL connection nightmare : DBX Error: Driver could not be properly initialized
if CoInitialize(Nil) > 0 then begin
SQLConnection := TSQLConnection.Create(nil);
SQLConnection.DriverName := 'MSSQL';
SQLConnection.GetDriverFunc := 'getSQLDriverSQLServer';
SQLConnection.LibraryName := 'dbxmss.dll';
SQLConnection.VendorLib := 'sqlncli11.dll';
SQLConnection.LoginPrompt := False;
SQLConnection.Params.Clear;
SQLConnection.Params.Add('drivername=MSSQL');
SQLConnection.Params.Add('schemaoverride=%.dbo');
SQLConnection.Params.Add('hostname=SQLEXPRESS');
SQLConnection.Params.Add('database=LogSwitch');
SQLConnection.Params.Add('blobsize=1');
SQLConnection.Params.Add('localcode=0000');
SQLConnection.Params.Add('isolationlevel=ReadCommited');
SQLConnection.Params.Add('os authentication=True');
SQLConnection.Params.Add('prepare sql=False');
SQLConnection.Connected := true;
end;
Upvotes: 2
Views: 1576