alejobog
alejobog

Reputation: 21

dbexpress and SQL Server

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.

  1. Check the library
  2. copy it system32
  3. copy it SysWow.
  4. Copy it to the directory of the .exe
  5. Start the CoInitilized of ActiveEx
  6. Uninstall the sql server express
  7. Use the devart component.
  8. Register the library (regsvr32 sqlncli11.dll).
  9. Obviously install the native client, SQL Server!

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

Answers (0)

Related Questions