Board index » delphi » Installation with BDE and ODBC

Installation with BDE and ODBC

I have written an application which uses an ms-access database which is
accesses using ODBC. Anyone know how to make a setup-procedure which
installs the minimum required BDE files, and makes the ODBC-entry?

I have tried to use this install-shield express (I think it is) that comes
with BD5, but it doesn't seem to work.

Thanx

Henrik

 

Re:Installation with BDE and ODBC


InstallShield Express works fine if you select Full BDE and ODBC 3.0
objects.

"Henrik Eidem Kurka" <he...@wmdata.no> schreef in bericht
news:A47C1A259D12D31194870008C71EF37E01D5E385@WMSTO3SI1481...

Quote
> I have written an application which uses an ms-access database which is
> accesses using ODBC. Anyone know how to make a setup-procedure which
> installs the minimum required BDE files, and makes the ODBC-entry?

> I have tried to use this install-shield express (I think it is) that comes
> with BD5, but it doesn't seem to work.

> Thanx

> Henrik

Re:Installation with BDE and ODBC


But I haven't found a way to make the ODBC alias in Installshield.

And, what if I doesn't want the full BDE? The ODBC-driver itself should be
enough.

Henrik

Quote
"M.H. Avegaart" <avegaartNOS...@mccomm.nl> wrote in message

news:8ol1bq$dhn$1@porthos.nl.uu.net...
Quote
> InstallShield Express works fine if you select Full BDE and ODBC 3.0
> objects.

> "Henrik Eidem Kurka" <he...@wmdata.no> schreef in bericht
> news:A47C1A259D12D31194870008C71EF37E01D5E385@WMSTO3SI1481...
> > I have written an application which uses an ms-access database which is
> > accesses using ODBC. Anyone know how to make a setup-procedure which
> > installs the minimum required BDE files, and makes the ODBC-entry?

> > I have tried to use this install-shield express (I think it is) that
comes
> > with BD5, but it doesn't seem to work.

> > Thanx

> > Henrik

Re:Installation with BDE and ODBC


a. You can't use ODBC without the BDE (you are using the BDE to access
ODBC). If you want to access ODBC directly I suggest a BDE replacement (see
http://www.kylecordes.com/bag/index.html).

b. Make sure the required ODBC DSNs are present on the PC. Select the ODBC
3.0 or 3.5 object, press Settings..., select the Microsoft Access Driver
(*.mdb) and accept the current settings. Now select the required ODBC DSNs,
configure them if needed and you are done !

"Henrik Eidem Kurka" <he...@wmdata.no> schreef in bericht
news:A47C1A259D12D31194870008C71EF37E01D9F8CF@WMSTO3SI1481...

Quote
> But I haven't found a way to make the ODBC alias in Installshield.

> And, what if I doesn't want the full BDE? The ODBC-driver itself should be
> enough.

> Henrik
> "M.H. Avegaart" <avegaartNOS...@mccomm.nl> wrote in message
> news:8ol1bq$dhn$1@porthos.nl.uu.net...
> > InstallShield Express works fine if you select Full BDE and ODBC 3.0
> > objects.

> > "Henrik Eidem Kurka" <he...@wmdata.no> schreef in bericht
> > news:A47C1A259D12D31194870008C71EF37E01D5E385@WMSTO3SI1481...
> > > I have written an application which uses an ms-access database which
is
> > > accesses using ODBC. Anyone know how to make a setup-procedure which
> > > installs the minimum required BDE files, and makes the ODBC-entry?

> > > I have tried to use this install-shield express (I think it is) that
> comes
> > > with BD5, but it doesn't seem to work.

> > > Thanx

> > > Henrik

Re:Installation with BDE and ODBC


ps. You could also create the DSN at run-time.

The following example demonstrates the use of SQLConfigDatasource for MS
Access databases:

const
  ODBC_ADD_DSN = 1; // Add data source
  ODBC_CONFIG_DSN = 2; // Configure (edit) data source
  ODBC_REMOVE_DSN = 3; // Remove data source
  ODBC_ADD_SYS_DSN = 4; // add a system DSN
  ODBC_CONFIG_SYS_DSN = 5; // Configure a system DSN
  ODBC_REMOVE_SYS_DSN = 6; // remove a system DSN
  ODBC_REMOVE_DEFAULT_DSN = 7; // remove the default DSN

function SQLConfigDataSource(
  hwndParent: HWND;
  fRequest: WORD;
  lpszDriver: LPCSTR;
  lpszAttributes: LPCSTR): BOOL; stdcall; external 'ODBCCP32.DLL';

function AddDSN(const DSN, Database, Description: String): Boolean;
begin
  Result := SQLConfigDataSource(0, ODBC_ADD_DSN,
    'Microsoft Access Driver (*.mdb)', PChar(
    'DSN=' + DSN + #0 +
    'Driver=ODBCJT32.DLL'#0 +
    'DBQ=' + Database + ''#0 +
    'DefaultDir=' + ExtractFilePath(Database) + #0 +
    'Description=' + Description + #0 +
    'FIL=MS Access'#0 +
    'UID=Admin'#0));
end;

function RemoveDSN(const DSN: String): Boolean;
begin
  Result := SQLConfigDataSource(0, ODBC_ADD_DSN,
    'Microsoft Access Driver (*.mdb)', PChar(
    'DSN=' + DSN + #0));
end;

function RepairDB(const Database: String): Boolean;
begin
  Result := SQLConfigDataSource(0, ODBC_ADD_DSN,
    'Microsoft Access Driver (*.mdb)', PChar(
    'REPAIR_DB=' + Database + #0 +
    'UID=Admin'#0 +
    'PWD=PWSWAN'#0));
end;

function CompactDB(const Database1, Database2: String): Boolean;
begin
  Result := SQLConfigDataSource(0, ODBC_ADD_DSN,
    'Microsoft Access Driver (*.mdb)', PChar(
    'COMPACT_DB=' + Database1 + ' ' + Database2 + ' General'#0 +
    'UID=Admin'#0 +
    'PWD=PWSWAN'#0));
end;

ps. Database filenames have to be put between quotes (") for RepairDB and
CompactDB on Jet 4.0.

"Henrik Eidem Kurka" <he...@wmdata.no> schreef in bericht
news:A47C1A259D12D31194870008C71EF37E01D9F8CF@WMSTO3SI1481...

Quote
> But I haven't found a way to make the ODBC alias in Installshield.

> And, what if I doesn't want the full BDE? The ODBC-driver itself should be
> enough.

> Henrik
> "M.H. Avegaart" <avegaartNOS...@mccomm.nl> wrote in message
> news:8ol1bq$dhn$1@porthos.nl.uu.net...
> > InstallShield Express works fine if you select Full BDE and ODBC 3.0
> > objects.

> > "Henrik Eidem Kurka" <he...@wmdata.no> schreef in bericht
> > news:A47C1A259D12D31194870008C71EF37E01D5E385@WMSTO3SI1481...
> > > I have written an application which uses an ms-access database which
is
> > > accesses using ODBC. Anyone know how to make a setup-procedure which
> > > installs the minimum required BDE files, and makes the ODBC-entry?

> > > I have tried to use this install-shield express (I think it is) that
> comes
> > > with BD5, but it doesn't seem to work.

> > > Thanx

> > > Henrik

Other Threads