I tried to debug TODBCConnection and catch the value of ConnectionString,, but for some reason the debugger won't let me -even thought, I rebuilt lazarus with debug profile-.
anyway, this is the message I get:
Could not connect with connection string "DRIVER={Microsoft Access Driver (*.mdb)};Dbq={D:\_Projects\SeesHelper\DATA\!SECG-ECO-2016.mdb};Uid=admin;Pwd=password;". ODBC error details: LastReturnCode: SQL_ERROR; Record 1: SqlState: HY000; NativeError: -1044; Message: [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.; Record 2: SqlState: 01000; NativeError: 1; Message: [Microsoft][ODBC Microsoft Access Driver]General Warning Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x2154 Thread 0x230c DBC 0x677b4c4 Jet'.;
and this is a cut down to how I open the DB:
procedure TfrmMain.OpenDataBase(ADBPath: string);
begin
if not FileExists(ADBPath) then
begin
ShowMessage(msgFileNotFound);
Exit;
end
//
// Close all TSQLQuery
//
dbConnection.Close(True);
dbConnection.Driver := 'Microsoft Access Driver (*.mdb)';
dbConnection.Params.Add('Dbq=' + UTF8ToCP1256(ADBPath) );
//This gives the same error
//dbConnection.Params.Add('Dbq=' + ADBPath );
dbConnection.Params.Add('Uid=admin');
dbConnection.Params.Add('Pwd=password');
dbConnection.Open
end;
// No other parameters are changed in the ObjectInspector for dbConnection
if I rename the file from
!SECG-ECO-2016.mdb to
SECG-ECO-2016.mdb,, the Database opens successfully.
[EDIT]
BTW, changing the driver to
Microsoft Access Driver (*.mdb, *.accdb) gives this error message:
Could not connect with connection string "DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};Dbq={D:\_Projects\SeesHelper\DATA\!SECG-ECO-2016.mdb};Uid=admin;Pwd=password;". ODBC error details: LastReturnCode: SQL_ERROR; Record 1: SqlState: HY000; NativeError: 63; Message: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xb0c Thread 0x2104 DBC 0x13817434 Jet'.; Record 2: SqlState: HY000; NativeError: 63; Message: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xb0c Thread 0x2104 DBC 0x13817434 Jet'.; Record 3: SqlState: HY000; NativeError: -1044; Message: [Microsoft][ODBC Microsoft Access Driver] Not a valid file name.;