What file is missing

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

What file is missing

Post by oz8hp » Tue 31 Mar 2015 08:10

I have an older app that uses UniDAC and it has been working fine for years. But now I would like to move it to another computer and then my problems start
The program uses MS Access database (can also use MSSQL, MySQL and SQLite) but on the new computer it won't run. It says that the database can't be found and that I know for a fact isn't the case.
If I move the files to yet another computer everything runs OK
The difference between the 2 computers is that the one where it doesn't run has no MS Office installed and the one where it runs has.
What files might I have to copy to the failing computer to get it running?

(Unfortunately I have no access to the source files for this program and I have no contact with the guy who made it)

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: What file is missing

Post by oz8hp » Tue 31 Mar 2015 08:50

PS: I tried installing MS Office on the failing computer and then the program works. But I want it to run without Office installed as I have no more licenses for it so I can only install a demo.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: What file is missing

Post by AlexP » Tue 31 Mar 2015 09:29

Hello,

To work with a MS Access database on, an ODBC driver is required to be installed on the PC - Microsoft Access Driver. It is available for download on the Microsoft website.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: What file is missing

Post by oz8hp » Tue 31 Mar 2015 12:54

Have you got a name of that driver?

There is none to be found on Microsoft.com as far as I can se and MDAC is not and option on Windows 7

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: What file is missing

Post by AlexP » Wed 01 Apr 2015 07:01

To work with MS Access, UniDAC uses the standard ODBC driver - Microsoft Access Driver.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: What file is missing

Post by oz8hp » Wed 01 Apr 2015 08:42

That might be so but it doesn't not work until I installed the AccessDatabaseEngine I found after long time search on the web

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: What file is missing

Post by AlexP » Wed 01 Apr 2015 11:58

Please make sure this driver is not installed on your PC any more. The list of drivers is available in ODBC Data Source Administrator (C:\Windows\SysWOW64\odbcad32.exe - 32-bit drivers, C:\Windows\System32\odbcad32.exe - 64-bit drivers). The same driver of different bitness can't be installed simultaneously.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: What file is missing

Post by oz8hp » Wed 01 Apr 2015 12:29

It doesn't help to add the ODBC driver using ODBC Data Source Administrator (it is a 32 bit Windows 7 DK) but installing the databaseengine helped so I don't know what to say.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: What file is missing

Post by AlexP » Thu 02 Apr 2015 08:11

This ODBC driver (Microsoft Access Driver) is usually installed with Windows automatically. Please specify the exact version of the installed driver (you can learn it from ODBC Data Source Administrator).

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: What file is missing

Post by oz8hp » Fri 03 Apr 2015 08:01

There is a screenshot of the driverversion in my Dropbox
https://dl.dropboxusercontent.com/u/65392149/driver.png

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: What file is missing

Post by AlexP » Mon 06 Apr 2015 07:53

We can't reproduce the problem on the same version of the driver. The problem may be due to a particular PC. Please try to reproduce the case using the standard components (for example, BDE), and let us know the result.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: What file is missing

Post by oz8hp » Wed 08 Apr 2015 07:46

What I have done now is creating a very basic ADO sample https://dl.dropboxusercontent.com/u/653 ... DOtest.zip and tried that on a complete new Windows 7 installation with all available updates - and it runs as it is supposed to
When I take my program that uses UniDac it doesn't run on the same computer

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: What file is missing

Post by AlexP » Wed 08 Apr 2015 08:26

Microsoft.Jet.OLEDB.4.0 driver is used in your project. UniDAC uses ODBC driver. Replace the provider with Microsoft OLE DB Provider for ODBC Drivers (MSDASQL.1), select a configured DSN and try to reconnect.

oz8hp
Posts: 151
Joined: Mon 18 Feb 2008 13:28
Location: Denmark
Contact:

Re: What file is missing

Post by oz8hp » Fri 10 Apr 2015 06:41

I am not quite sure what you suggest here.
As I said earlier I have no access to the source of this program

I am quite sure the programmer has used the same method as I have been using for MS Access all the time I worked with UniDAC in my previous job as it was his datamodule I used.
I found the source for that in an old backup and pasted it below.

But if I can't get it to work with the MS Access file, I will just keep on using a SQLite file as that works OK on the new computer


unit F_UniConn;

interface

uses
{$Include UniDACCommon.inc}
Db, MemDS, DbAccess, Uni, DAScript, UniScript,
Classes, Forms, MemData, SysUtils, Windows;

type
TfrmUniConn = Class(TDataModule)
UniServer: TUniConnection;
UniScript: TUniScript;
procedure DataModuleDestroy(Sender: TObject);
procedure UniServerConnectionLost(Sender : TObject; Component : TComponent;
ConnLostCause : TConnLostCause; var RetryMode : TRetryMode);
procedure UniScriptError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
procedure UniScriptBeforeExecute(Sender: TObject; var SQL: string; var Omit: Boolean);
private
fResult: integer;
published
function CreateQuery: TUniQuery;
public
property Result: integer read fResult write fResult;
constructor Create(aOwner: TComponent); reintroduce;
end;

var
frmUniConn: TfrmUniConn;

implementation

uses
U_Logfile,
U_DbList, U_Settings;

{$R *.dfm}

constructor TfrmUniConn.Create(aOwner: TComponent);
begin
inherited Create(aOwner);
try
UniServer.ProviderName := DbList.Items[Settings.Database.Provider].ProviderName;
UniServer.Server := Settings.Database.Host;
UniServer.Database := Settings.Database.Name;
UniServer.LoginPrompt := False;
UniServer.Options.LocalFailover := True;
case Settings.Database.Provider of
dbMySQL :
begin
UniServer.Port := Settings.Database.Port;
UniServer.Username := Settings.Database.UserName;
UniServer.Password := Settings.Database.UserPass;
UniServer.SpecificOptions.Values['UseUnicode'] := 'True';
end;
dbMSSQL :
begin
UniServer.Port := Settings.Database.Port;
UniServer.Username := Settings.Database.UserName;
UniServer.Password := Settings.Database.UserPass;
UniServer.SpecificOptions.Values['ApplicationName'] := Application.Name;
UniServer.SpecificOptions.Values['OLEDbProvider'] := 'prSQL';
UniServer.SpecificOptions.Values['ConnectionTimeout'] := '100';
// UniServer.SpecificOptions.Values['MultipleActiveResultSets'] := 'True';
// UniServer.SpecificOptions.Values['Provider'] := 'prNativeClient';
// UniServer.SpecificOptions.Values['Authentication'] := 'AuWindows'
// UniServer.SpecificOptions.Values['Authentication'] := 'AuServer'
end;
dbSQLite :
begin
UniServer.Username := '';
UniServer.Password := '';
UniServer.SpecificOptions.Values['UseUnicode'] := 'True';
// UniServer.SpecificOptions.Values['SQLite.ClientLibrary'] := ExtractFilePath(Paramstr(0)) + 'sqlite3.dll';
end;
dbMSAccess :
begin
UniServer.Username := '';
UniServer.Password := '';
UniServer.SpecificOptions.Values['UseUnicode'] := 'True';
UniServer.SpecificOptions.Values['ExtendedAnsiSQL'] := 'True';
end;
end;
UniServer.Connect;
except on E:Exception do
Logfile.Database.Error('F_UniConn.Create: ' + E.Message);
end;
end;

function TfrmUniConn.CreateQuery: TUniQuery;
begin
try
Result := TUniQuery.Create(nil);
Result.Options.LongStrings := True;

Result.Connection := UniServer;
except
on E: exception do
begin
Logfile.Error('F_UniConn.CreateQuery: ' + E.Message);
Result := nil;
end
end;
end;

procedure TfrmUniConn.DataModuleDestroy(Sender: TObject);
begin
UniServer.Disconnect;
end;

procedure TfrmUniConn.UniScriptBeforeExecute(Sender: TObject; var SQL: string; var Omit: Boolean);
begin
Result := 0;
end;

procedure TfrmUniConn.UniScriptError(Sender: TObject; E: Exception; SQL: string; var Action: TErrorAction);
begin
Action := eaContinue;
Result := EDAError(E).ErrorCode;
Logfile.Database.Error('Server error: ' + IntToStr(EDAError(E).ErrorCode) + ' - ' + E.Message);
Logfile.Database.Event(uniScript.SQL.Text);
end;

procedure TfrmUniConn.UniServerConnectionLost(Sender: TObject;
Component: TComponent; ConnLostCause: TConnLostCause;
var RetryMode: TRetryMode);
begin
RetryMode := rmReconnectExecute;
end;


end.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: What file is missing

Post by AlexP » Fri 10 Apr 2015 09:36

We can't reproduce the problem. If you can give us access to the "problem" machine (for example, using TeamViewer), we can check this behavior on a particular PC.

Post Reply