When obtaining the Oracle table structure, the column data type "data_type" value obtained by the two oledb drivers is of different types.

Source: Internet
Author: User

Use oledbconnection. getoledbschematable (oledbschemaguid. columns, new object [] {null, schemaname, tablename, null}) when obtaining the schema information of a column, the returned datatable column is "data_type ", is to use a number to identify the data type of the column. This number may be of the decimal or int32 type:

If "provider = msdaora.1;", the type of the column "data_type" is int32;
If "provider = oraoledb. Oracle;", the type of the column "data_type" is decimal.

After understanding the difference, the conversion error will not occur when converting the column data type to the string of the corresponding type in the oledbtype enumeration, because
Enum. getname (typeof (oledbtype), intvalue)
The second parameter of the method must be int32. Of course, Microsoft's driver does not solve this problem. If Oracle driver is used, decimal must be converted to int32 first.

In addition, I also found a problem: Among the parameters passed to the getoledbschematable () method, Microsoft drivers are case insensitive, but Oracle drivers must be capitalized. In fact, Oracle is not case sensitive in general SQL statements. Only when an oracle dictionary table is involved, Oracle requires that all object names be capitalized. Therefore, I guess the oledb driver implemented by Oracle actually reads dictionary tables such as user_tab_columns in the background. As an experience, the toupper () character string should be used when passing parameters.

Tutorial: I access the Oracle database in the project using the oracleclient namespace. However, I have never been right about which driver to use in oledb mode.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.