Failed to back up SQL Server database using ODBC

Source: Internet
Author: User
Tags odbc microsoft website

The software was originally using ADO to access LocalDB, now switched to open source ODBC C + + package Nanodbc,

Everything else is ok after debugging, but although the backup DATABASE command returns successfully, the actual backups are unsuccessful.

Checked the information and found an answer on the Microsoft website.

This was by design. Your application must call SQLMoreResults to ensure all the results of the statement is consumed and hence completed. BACKUP sends several messages back to the user-report progress and statistics, and SQLExecDirect returns when the first Of these messages is returned. This does isn't mean the backup has fully completed though. Once SQLMoreResults returns SQL_NO_DATA, you can safely close the statement handle, as you ve observed.

You must call SQLMoreResults after the backup command is executed, NANODBC cannot use Just_execute, you need to use Execute and call Result::next_result

Failed to back up SQL Server database using ODBC

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.