Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

commit

Make database changes permanent

Syntax

commit(conn)

Description

commit(conn) makes permanent changes made to the database connection conn since the last commit or rollback function was run. To run this function, the AutoCommit flag for conn must be off.

Examples

Example 1 — Check the Status of the Autocommit Flag

Check that the status of the AutoCommit flag for connection conn is off.

get(conn,'AutoCommit')
ans =
	off

Example 2 — Commit Data to a Database

  1. Insert exdata into the columns DEPTNO, DNAME, and LOC in the table DEPT, for the data source conn.

    datainsert(conn,'DEPT',...
    {'DEPTNO';'DNAME';'LOC'},exdata)
    
  2. Commit this data.

    commit(conn)
    

Tips

For ODBC connections, you can use the commit function with the native ODBC interface. For details, see database.

Introduced before R2006a

Was this topic helpful?