The following steps describe how to use 32-bit ODBC data sources with 64-bit Genstat when you do not have 32-bit Genstat installed. If you can install 32-bit Genstat, this process is much easier, and that would be a good option. If you do install 32-bit Genstat, then use this help page Using 32-bit ODBC with 64-bit Genstat when 32-bit Genstat is installed.
Open the 32-bit ODBC control panel
The 32-bit ODBC Control panel is opened using %systemdrive%WindowsSysWoW64Odbcad32.exe.
The 64-bit ODBC Control application can opened by running the file %systemdrive%WindowsSystem32Odbcad32.exe.
This is confusing as the 32-bit version is in the directory SysWoW64 and the 64-bit version is in the directory System32, but this is because the directory System32 was not changed from 32-bit Windows for compatibility, and SysWOW64 implements Windows 32-bit on Windows 64-bit. Note %systemdrive% is C: on most PCs.
- To open the 32-bit ODBC control panel, click on the Start button.
OR
For XP click the Run menu item.
OR
For Windows 7/Vista use the Search field, and type C:\Windows\SysWoW64\Odbcad32.exe
(or another drive letter other than C: if that is not your Windows system drive) then press ENTER.
The ODBC control panel should open as below. Go to the Drivers tab to verify it is the version with the drivers you need, as below. Note Office ODBC drivers for a range of languages may be installed.
Create a File DSN
You must get the DSN string the Genstat server procedures need to connect to the correct ODBC driver. To do this you need to create a DSN in the 32-bit ODBC control panel and then edit the DSN file to obtain the text required as outlined below.
- In the ODBC Control panel application on the File DSN tab then click Add.
Continue to specify the filename, select the driver, and the database. This process is the same as described in the help page ODBC Databases. - Open the DSN file with a text editor. The DSN file you created in step 1 above, is generally found in the directory C:\Program Files (x86)Common Files\ODBCData Sources, but may be saved anywhere.
You will need to note where it was saved in step 1, above. You can open the .dsn file into the Notepad text editor by right mouse clicking on the file and using the menu Send to | Notepad. The following window shows a File DSN opened into Windows Notepad: - Create the DB string by concatenating lines in the DSN file, separated by semicolons. Copy the strings from the second line down (i.e. ignoring the [ODBC] on the first line), and append these into a single text by deleting the line breaks and replacing these with semicolons.
In the Genstat text editor you may want to break the text onto several lines using the continuation character. Also you will need to add an extra backslash along side any directory backslash in the strings
(i.e. C:\Program FilesGen15edDataCardata.mdb will need to become C:\Program Files\Gen15ed\Data\Cardata.mdb) to avoid the folder or file names from being truncated.The window below shows the DSN shown in Notepad above set up in a Genstat command file.
Once you have DSN string, then you can use this for the DB parameter for either the DBIMPORT or DBIMPORT procedures.
Reading 32-bit ODBC data into 64-bit Genstat
- You will need to provide a 32-bit data source name (DSN) (as described above) as the DB parameter of DBIMPORT and set the option DRIVER=32.
- Create an SQL statement to be run against the ODBC DSN. Help on this can be found in SQL Statements.
Writing 32-bit ODBC data from 64-bit Genstat
- You will need to provide a 32-bit data source name (DSN) (as described above) as the DB parameter of DBEXPORT and set the option DRIVER=32.
- Set the parameters (TABLE etc.) of DBEXPORT to create, insert or merge data into the ODBC database.
The approach above will also work for 64-bit ODBC drivers but the DRIVER option and DSN string must match the version (32 or 64-bit) of the ODBC driver to work.
Notes
You there is no apparent difference in the two control panels, but a DSN created by one will not work with the other. A 32-bit DSN will only work with a 32-bit application, and a 64-bit DSN will only work with a 64-bit application. There is no obvious way of telling which DSN are which, although they have different connection strings internally. However, if you try and open a 32-bit DSN into the 64-bit ODBC Control panel you will get an error and vice-versa (as shown below).
Also, both 32 bit and 64 bit drivers can be displayed, and it’s not until you click the Add button that you can see which drivers are only available for that platform (i.e. 32 or 64-bit).
There are a range types of ODBC DSNs:
User DSN | Creates a data source that is specific to the user on the PC and cannot be used by other users. |
System DSN | Creates a data source that can be used by all users on a system or PC. |
File DSN | Creates a data source that can be used by any user who can access the file containing the data source information. |
The System DSNs are stored under the following registry subkey:
HKEY_LOCAL_MACHINESoftwareODBCODBC.INI
The User DSNs are stored under the following registry subkey:
HKEY_CURRENT_USERSoftwareODBCODBC.INI
The File DSNs can be stored anywhere, but the default location seems to be
C:Program Files (x86)Common FilesODBCData Sources.