Recognizing Datatypes by ODBC
When reading a database, HOPEX asks the database (Oracle in our example) what are the datatypes, throughthe intermediary of ODBC.
For example, if Oracle contains a datatype "SQL_LONGVARCHAR", HOPEX will know that this is a "P-Text" datatype.
To do this, HOPEX uses the "xmdb.xdr" file, located in the "Mega\Mega_Std" folder.
The part of the "xmdb.xdr" file that concerns correspondence of datatypes starts with the following line:
<!-- Mapping of standard Datatypes -->
Each line is presented as follows:
<!-- #DataType(5B845EAE3BAF0020) = "SQL_LONGVARCHAR"
Standard::Types::Pivot::P-Text -->
• The figure between brackets (here 5B845EAE3BAF0020) is the absolute identifier of the datatype.
• The text between quotation marks (here SQL_LONGVARCHAR) is the name of the ODBC datatype.
• The path that follows (here Standard::Types::Pivot::) specifies in which HOPEX package the corresponding data type is located.
• Finally, the HOPEX datatype (here P-Text) is indicated.
To recognize the datatypes the software uses, in order, the three following lists:
• List of datatypes added by the user.
When you create a datatype manually, in order that it will be recognized you must add a rule to the list.
• List of datatypes of the ODBC driver used.
Example: here there is one list of datatypes for Ingres and two lists for Oracle for different drivers (Oracle driver and Microsoft driver)
<!-- Declaration Rule Parser Datatypes for Ingres -->
<!-- #DataType(13ED147938B5008F) = "SQL_CHAR,SQL_INGRESC" Standard::Types::Pivot::P-Character -->
<!-- #DataType(5B845EAE3BAF0020) = "SQL_VARCHAR,SQL_INGRESTEXT" Standard::Types::Pivot::P-Text -->
<!-- #DataType(13ED1A3D38B501E0) = "SQL_DECIMAL,SQL_INGRESMONEY" Standard::Types::Pivot::P-Currency -->
<!-- #DataType(13ED1A3038B501D5) = "SQL_TIMESTAMP,SQL_INGRESDATE" Standard::Types::Pivot::P-Date -->
<!-- Declaration Rule Parser Datatypes for Oracle with Oracle Driver -->
<!-- #DataType(B55EB70C3471008F) = "SQL_TIMESTAMP,SQL_Oracle8DATE" Standard::Types::Pivot::P-Datetime -->
<!-- #DataType(45F44A3B3BAF003D) = "SQL_VARBINARY,SQL_Oracle8RAW" Standard::Types::Pivot::P-Binary -->
<!-- #DataType(B55EB71E347100BC) = "SQL_VARCHAR,SQL_Oracle8ROWID" Standard::Types::Pivot::P-Timestamp -->
<!-- #DataType(B55EB6F134710044) = "SQL_DECIMAL,SQL_Oracle8DECIMAL" Standard::Types::Pivot::P-Numeric -->
<!-- #DataType(B55EB6F134710044) = "SQL_TINYINT,SQL_Oracle8NUMBER(3,0)" Standard::Types::Pivot::P-Numeric -->
<!-- #DataType(B55EB6F134710044) = "SQL_INTEGER,SQL_Oracle8DECIMAL" Standard::Types::Pivot::P-Numeric -->
<!-- Declaration Rule Parser Datatypes for Oracle with Microsoft Driver -->
<!-- #DataType(B55EB70C3471008F) = "SQL_TIMESTAMP,SQL_OracleDATE" Standard::Types::Pivot::P-Datetime -->
<!-- #DataType(45F44A3B3BAF003D) = "SQL_VARBINARY,SQL_OracleRAW" Standard::Types::Pivot::P-Binary -->
<!-- #DataType(B55EB71E347100BC) = "SQL_CHAR,SQL_OracleROWID" Standard::Types::Pivot::P-Timestamp -->
<!-- #DataType(B55EB6F134710044) = "SQL_DECIMAL,SQL_OracleNUMBER" Standard::Types::Pivot::P-Numeric -->
• List of standard datatypes.
Datatype Recognition Problems
It is necessary to add a correspondence between datatypes in the "xmdb.xdr" file in the following two cases:
• The datatype is incorrectly recognized.
The user can confirm this by noting for example that an "Integer"
datatype in Oracle becomes a "P-Number" datatype in MEGA, instead of
"P-Integer".
• The datatype is not recognized.
When the datatype is not recognized, a message of the following type
appears at the bottom of the dialog box when reading the target
database:
DataType 'SQL_Data8' not recognized. See Help for how to configure
correspondence of Datatypes.
To add a datatype correspondence:
1. Open the extraction results file.
2. Locate in this file the correspondence between the datatypes.
For example, in the expression:
<COLDATATYPE
Name="COLDATATYPE.JAVA036HTTP036DEPLOYMENT036DIGEST036.IS09
5DOC095ROOT" DataType="SQL_DECIMAL"
the ODBC datatype is "SQL_DECIMAL" and the HOPEX datatype is "SQL_Oracle8DECIMAL".
3. Add in any location in the "xmdb.xdr" file a line indicating the correspondence between datatypes constructed as above.
Example:
<!-- #DataType(B55EB6F134710044) = "SQL_Data8"
Standard::Types::Pivot::P-Text -->
Here we have defined the "SQL_Data8" datatype as a "P-Text" datatype.