Flexible ODBC Database Locations
second draft
We have a directory structure with root for central files and subdirectories for each company number. In the past, we couldn't find an easy solution to connect with ODBC. Some messages of today from Steve Blank and others give us the following idea.
(oh oh - this is not easy for me to explain in english. Please correct all my spelling!)
Structure (SHOPN=Root. 000,001,...,999 = company number.)
We get the right directory with
INIPUT ('[MAGIC_LOGICAL_NAMES]FIRMA='&STR (CompanyNo,'3P0'))
The tables are flexible defined with %FIRMA% stored in Locical Names and the company (Firma) can be selected in Magic.
Create
Pervasives DDFs to access in Magic.
PervasiveODBCMaintainDB
Write a start program to correct the data location in file.ddf
As each table name has a well defined prefix, we know which table is at root and which at company subdirectory. The start program is called after each change of the company number.
Example:
Prefix 'T' = Root for all companies
Prefix 'N' = File stored in company subdirectory
Draft function
If the prefix is 'T' ===> do nothing
If the prefix is 'N' and if not done before ===> update fileloc (in file.ddf) to CompanyNo&'\'&fileloc
Now we are able to connect with ODBC to the root and the specific chosen company files!
Categories
CategoryHowTo
There are no comments on this page. [Add comment]