JDBC connection to excel strings

Source: Internet
Author: User
You can use the select * From sheet1 $ method to read data, which is as convenient as normal select statements. However, two problems were encountered in the middle: 1. when you use the default method to read data, the first row in Excel will become the column title, rather than the Data Reading; 2. the merged cell data and text information in some numeric columns are lost. After checking N records for a long time, we found that the above two problems can be solved by adding additional parameters in the connection string of the ADO control. Driver ProgramUse: provider = Microsoft. jet. oledb.4.0; data source, pointing to the Excel file data source=abc.xls you need to read; you need to specify the following additional parameters to read the Excel file; and the next two parameters, extended properties = Excel 8.0; HDR = no; IMEX = 1; the parameters HDR and IMEX mean HDR = yes; "indicates that the first row contains columnnames, not data" IMEX = 1; "tells the driver to always read" intermixed "Data columns as text HDR = No, the first line is data, not the title! If the above connection string parameter is not set correctly, the system will throw Unable to find the installable isamError!

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.