Berkeley DB: Db.sync
Description: Berkeley DB: An embedded database programmatic toolkit.
Keywords: embedded,database,programmatic,toolkit,b+tree,btr ee,hash,hashing,transaction,transactions,locking,logging,access method,access me thods,java,C,C++

# Db.sync

`

###

    import com.sleepycat.db.*;

    public void sync(int flags)
    	throws DbException;

# Description

The Db.sync method flushes any cached information to disk.

If the database is in memory only, the Db.sync method has no effect and will always succeed.

The flags parameter is currently unused, and must be set to 0.

See Db.close for a discussion of Berkeley DB and cached data.

The Db.sync method throws an exception that encapsulates an errno on failure.

# Errors

If a fatal error occurs in Berkeley DB, the Db.sync method may fail and throw a DbRunRecoveryException, at which point all subsequent database calls will also fail in the same way.

The Db.sync method may fail and throw an exception for any of the errors specified for the following Berkeley DB and C library functions: Db.cursor, Db.get, Db.sync, DBcursor->c_close(3), __account_page(3), close(3), dbenv->db_paniccall(3), fcntl(3), fflush(3), fprintf(3), free(3), func(3), DbLockTab.get, DbLock.put, DbLockTab.vec, DbLog.put, malloc(3), memcpy(3), memmove(3), DbMpoolFile.get, DbMpoolFile.put, DbMpoolFile.set, DbMpoolFile.sync, memset(3), munmap(3), open(3), realloc(3), sigfillset(3), sigprocmask(3), strerror(3), unlink(3), vfprintf(3), vsnprintf(3), and write(3).

In addition, the Db.sync method may fail and throw an exception encapsulating errno for the following conditions:

EINVAL
  An invalid flag value or parameter was specified.

# Class

Db

# See Also

Db.close, Db.cursor, Db.del, Db.fd, Db.get, Db.get_byteswapped, Db.get_type, Db.join, Db.open, Db.put, Db.stat and Db.sync.`