|
Configuration
ODBC 4 ALL configuration is performed using a Windows standard INI file.
You can create some different INI configuration files containing different settings (for example different DSN's or SQL queries) and tell ODBC 4 ALL which one it has to use by starting it with a parameter:
C:\Program Files\Odbc4All> Odbc4All C:\SqlCommands\MyConfig.INI
If you do not specify the INI configuration file, ODBC4ALL.INI will be used. If it is not present, the interactive mode is assumed (the default mode just after installing it).
Here is the configuration file structure:
| [ODBC] section |
| DSN |
In order to access to any table via ODBC you must create a DSN (Data Source Name) from the ODBC32 configuration, which can be found on the Windows Control Panel.
Sometimes you can find that your ODBC32 configuration already contains some general purposes entries (like the Ms Access 97 Database). If you link to this generic, unconfigured entries, you will be prompted for the database file name at connection time. |
| User |
Here you can insert the (optional) username to connect to the database server. |
| Password |
Here you can insert the (optional) password to connect to the database server. |
| SQL |
This is the SQL command you want the database server to run. |
| SQLx |
Optionally, you can put your SQL statement in several different lines, calling them SQL1, SQL2 and so on. For Example:
SQL=Select "long field name",field2,field3 as MyAlias
SQL1=from MyTable
SQL2=order by field2 desc |
You can use how many SQLx lines you want, but they have to be consecutives (i.e. you can use SQL, SQL1 and SQL2, but you cannot use SQL, SQL2 and SQL3, because SQL1 is missing) |
| Asyncronous |
Setting this entry to .T. (true), enables the asyncronous retrieving of the data. This is useful when the output is shown on the screen, for very long cursors or when the connection bandwidth with the server is slow. |
| [Output] section |
| Type |
The Type value could be: AsciiFile, AsciiTable, DBF or Screen (default)
- AsciiFile: TAB delimited ascii file. The 1st row contains the field names
- AsciiTable: Ascii file containing data in a table. 3 rows at the top are for the header. 1 line is added at the end of the data for the table's footer
- DBF : The result of the SQL query will be put on a standard DB3 database
- Screen: The data will be shown on a screen grid.
This is only valid for SELECT queries (i.e. queries which returns a cursor), while UPDATE, INSERT, DELETE etc. queries do not shows any output (but they can show error messages, see FileErr below) |
| FileOut |
If Type is set to DBF , AsciiFile or AsciiTable, you can insert the file name (with optional path) in the FileOut entry.
If FileOut is not set, the default values are:
- odbc4all.dbf if Type=DBF
- odbc4all.txt if Type=AsciiFile or AsciiTable
|
| FileErr |
If you want to redirect the error messages to an ascii file instead to display them on the screen, then you can insert the file name (with optional path) here. This is used either for SELECT queries or for INSERT, UPDATE etc. |
| DecChar |
If Type is set to AsciiFile or AsciiTable, you can decide which character you want to use as the decimal separator for the numeric fields.
This is particurarly useful if you want to import ascii files using some localized version of Excel (and other programs) which wants numeric fields with decimals separated by a comma (",") The default value is a dot (".") |
| DecNo |
Some SQL data types do not have a specific decimal length, like double, float or real data types. In those cases, by using this entry you can set how many decimal places you want to round the value. You can specify any number between0and 13.
If not specified, those values will be rounded to 2 decimals. |
| [Options] section |
| SupportEMail |
By default, if Odbc4All execution terminates abnormally, at next startup it opens an automatically generated e-mail (by using your default e-mail client) to be sent to the Support Team.
Your e-mail client must be MAPI compatible otherwise no mail is generated.
The e-mail DOES NOT CONTAIN ANY PERSONAL DATA, but an Error Report, useful to solve the problem. The user can always choose whether to send the e-mail or to close the window.
Setting this entry to .F. , the Auto Notification Error feature will be permanently disabled.
If you want to re-enable it later, do not set this entry to .T., but remove the entire line from the INI file instead. |
EXAMPLE
C:\SQLCOMMANDS\MYCONFIG.INI [ODBC]
DSN=MyDatabase
User=Admin
Password=password
SQL=Select "long field name",field2,field3 as MyAlias from MyTable order by field2 desc
[Output]
Type=AsciiFile
FileOut=c:\SqlCommands\MyConfig.txt
FileErr=c:\SqlCommands\MyConfig.err |
|