Article ID: 3258, created on Nov 30, 2007, last review on May 11, 2014

  • Applies to:
  • H-Sphere

Resolution

This document explains how to add your own ODBC drivers to H-Sphere Winbox. Please contact us if this document doesn't work for your version of H-Sphere.

Interface

The following scripts are used:



odbc-getdrivers.asp
odbc-getparams.asp
odbc-createdatasrc.asp
odbc-updatedatasrc.asp
odbc-deletedatasrc.asp

odbc-getdrivers.asp

description:
returns a list of available ODBC divers
parameters:
none
return value:
successful - 0<list of driver names>
fail - error message
comments:
script returns the list of drivers that are both installed on the box and supported by H-Sphere 2.x (they are registered in ODBCIniFile).

odbc-getparams.asp

description:
returns a list of addmissible attributes for this ODBC driver
both methods "GET" and "POST" are supported
parameters:
driver - driver name
return value:
successful - 0<list of admissible driver attributes>
fail - error message
comments:
every parameter has the following format:
<attribute name>|<type>|<default value>|<description>|[<value1[;value2[;value3...]
See below for details on this format.

odbc-createdatasrc.asp

description:
creates new data source
only "POST" method is supported
parameters:
driver-name
DSN - name of the new data source
user-name - user's accout name
<list of admissible attributes of this ODBC driver and their values>
return value:
successful - 0
fail - error message
comments:
1) all attributes with empty values are ignored;
2) all attributes with a type path (see below) get a path to user's homedir, but the existence of this path is not verified
3) data source name is created according to the pattern: user-name + DSN

odbc-updatedatasrc.asp

description:
updates parameters of the existing data source
only "POST" method is supported
parameters:
driver-name
DSN - name of the new data source
user-name - user's accout name
<list of admissible attributes of this ODBC driver and their values>
return value:
successful - 0
fail - error message
comments:
default values are set for attributes that have not been specified or have empty values.
all comments to data source creation are also true of data source update.

odbc-deletedatasrc.asp

description:
deletes existing data source.
both "GET" and "POST" methods are supported
parameters:
driver-name
DSN - name of the new data source.
user-name - user's accout name
return value:
successful - 0
fail - error message
comments:
no comments

Configuration

To configure ODBC use a file of the below format. Full path to this file is registered in conf.inc (the "ODBCIniFile" variable). By default it is called "odbcdrv.ini" and sits in the directory with ASP scripts.

This file has a usual windows .ini file format, i.e. is broken into sections with headings enclosed in square brackets. Every section corresponds to an ODBC driver, its name being the heading of the section. The body of the section includes driver attributes in the following format:

<attribute name>=<type>|<default value>|<description>|[<value1[;value2[;value3...]

where:

  • <attribute name> - name of the ODBC driver attribute (e.g. DBC)
  • <type> - typically a string of the type: <typeid>_[required|optinal], where typeid is the name of the type, e.g. "string", that can be required or optional depending on the parameter. Can take the following values:
    path_required - required path (an individual path type is required to identify relative path to userhome dir)
    path_optional - optional path
    string_required - required string
    string_optional - optional string
    string_password - password
    integer_required - mandatory integer value
    integer_optional - optional integer value
    select_required - mandatory list of values
    select_optional - optional list of values
    trigger - radio-button switch
  • <default value> - default value for the given attribute; a space if missing (NOT AN EMPTY STRING!)
  • <description> - attribute description
  • <value1[;value2[;value3... - values for the list; must be filled only for the 'select' types. Use semicolon (;) as delimiter.

To add a new ODBC driver to the ODBCIniFile, add a new section with the heading identical to the name of the driver and the attributes that are described according to the above rules.

Note: When a user enables an ODBC resource, H-Sphere lists drivers that can be found both among those installed on the server and those in the odbcdrv.ini file. The obcdrv.ini file contains:

  • [Microsoft Paradox Driver (*.db )]
  • [Microsoft Access Driver (*.mdb)]
  • [Microsoft Visual FoxPro Driver]
  • [Microsoft dBase Driver (*.dbf)]
  • [Microsoft Excel Driver (*.xls)]
  • [SQL Server]
  • [MySQL]
  • [MySQL ODBC 3.51 Driver]
  • [PostgreSQL]

f213b9fa8759d57bee5d547445806fe7 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF