ODBC Install progammatically

ODBC Install progammatically

Post by Markku Nevalaine » Sun, 31 Dec 1899 09:00:00



I would like to save the users having to run ODBC install program to install
Access 2.0 ODBC-drivers to system. And later to do the connections to Access
files in different locations.
Does anybody have code, how to do this programmatically from D1 app? That's
probably done with some link to MS's ODBCINST.DLL?

I found one reference about some free code from DejaNews, but the senders e-mail
address was out of date.

Markku Nevalainen

 
 
 

ODBC Install progammatically

Post by Esa Rai » Sun, 31 Dec 1899 09:00:00


On Tue, 10 Feb 1998 09:25:27 +0300, Markku Nevalainen


>I would like to save the users having to run ODBC install program to install
>Access 2.0 ODBC-drivers to system. And later to do the connections to Access
>files in different locations.
>Does anybody have code, how to do this programmatically from D1 app? That's
>probably done with some link to MS's ODBCINST.DLL?

Download ODBC 3.0 specification from:
http://www.microsoft.com/data/odbc/download.htm

This contains API-reference for the installer DLLs and tells you what
files you must distribute with your setup program. Unfortunately MS
has removed the 16-bit ODBC 2.0 SDK from their website and requires
you to buy their MSDN CD if you still want it but the 3.0 help file
does point out the differences between the different ODBC versions.

 
 
 

ODBC Install progammatically

Post by Kirk Gra » Sun, 31 Dec 1899 09:00:00


I have managed to get a System DSN created via code, It seems to work OK on my
machine, But the registry structure could change on the next ODBC version, so The
Risk is Yours.

The GetRegsetting/SetRegsetting functions are not included here but I'm sure You get
the Idea. (These DSNs are specifically for MS Access)

function DSNExists(DSNNAme : string ) : boolean;

begin
     DSNExists :=
getregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.INI\ODBC Data
Sources\'+DSNName) <> NotFound;
end;

procedure createAccessDSN(DSNName : String; DataBasePath : string; Desc : string);

var
   driver : string;
begin
     //Create DSN Name entry...
     setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.INI\ODBC Data
Sources\'+DSNNAme,'Microsoft Access Driver (*.mdb)');

     //Get driver name and path...
     driver :=
getregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBCINST.INI\Microsoft Access
Driver (*.mdb)\Driver');

setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\DBQ',databasepath);

setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\DefaultDir',justdir(databasepath));

setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\Description',Desc);

setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\Driver',Driver);

setregsettingWord(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\Driverid',25);

setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\FIL','MS
Access;');

setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\PWD','');

setregsettingstring(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\UID','Admin');

setregsettingword(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\Engines\Jet
2.x\MaxBufferSize',512);

setregsettingword(HKEY_LOCAL_MACHINE,'SOFTWARE\ODBC\ODBC.ini\'+DSNNAme+'\Engines\Jet
2.x\PageTimeout',600);
end;


> I would like to save the users having to run ODBC install program to install
> Access 2.0 ODBC-drivers to system. And later to do the connections to Access
> files in different locations.
> Does anybody have code, how to do this programmatically from D1 app? That's
> probably done with some link to MS's ODBCINST.DLL?

> I found one reference about some free code from DejaNews, but the senders e-mail
> address was out of date.

> Markku Nevalainen

 
 
 

1. HOWTO: Change progammatically an IDENTITY flag to YES or NO (with SQL if possible)

Patrice,

I'm admittedly reading between the lines, and so may be way off base. If so,
excuse me, and I apologize.

It sounds to me like you want to be able to occasionally insert rows with
specific IDENTITY values, rather than SQL Server generated values. If I'm
right, then you might check out the section "SET IDENTITY_INSERT (T-SQL)" in
the SQL Server 7.0 Books Online. If you are using SQL Server 6.x, check out
in the SQL Server 6.x Books Online, the sections "IDENTITY Property" and
"SET Statement".


2. Running Pervasive On Winframe or Win Terminal Server

3. Progammatically change location of Linked Tables in Access

4. P-dox 3.5 DoWait problem

5. Locate table progammatically in MS Access???

6. SQL -- inner & outer joins

7. How to install latest ODBC without installing SQL2000 ?

8. Stored Procedures: Writing a Line Feed to a Text Field

9. Should I first install ODBC to install SQL server

10. Problems Installing an ODBC-Alias with Install-Shield Express

11. ODBC Error when installing SQL Server ODBC driver

12. BDE and ODBC - how to install - "AUTO ODBC"-switch in BDECONFIG

13. when to install the orarun9i.rpm, before installing 9i or after installing 9i