Version 2.0.1
com.wiredtiger.db.Connection Class Reference

A connection to a WiredTiger database. More...

Public Member Functions

synchronized void delete ()
 
int close (String config)
 Close a connection. More...
 
int reconfigure (String config)
 Reconfigure a connection handle. More...
 
String get_home ()
 
int configure_method (String method, String uri, String config, String type, String check)
 Add configuration options for a method. More...
 
int is_new ()
 Return if opening this handle created the database. More...
 
int load_extension (String path, String config)
 Load an extension. More...
 
Session open_session (String config)
 

Protected Member Functions

 Connection (long cPtr, boolean cMemoryOwn)
 
int java_init (Object jsess)
 

Static Protected Member Functions

static long getCPtr (Connection obj)
 

Protected Attributes

boolean swigCMemOwn
 

Detailed Description

A connection to a WiredTiger database.

The connection may be opened within the same address space as the caller or accessed over a socket connection.

Most applications will open a single connection to a database for each process. The first process to open a connection to a database will access the database in its own address space. Subsequent connections (if allowed) will communicate with the first process over a socket connection to perform their operations.

Thread safety: A WT_CONNECTION handle may be shared between threads, see Multithreading for more information.

Member Function Documentation

int com.wiredtiger.db.Connection.close ( String  config)

Close a connection.

Any open sessions will be closed.

ret = conn->close(conn, NULL);
Parameters
connectionthe connection handle
configConfiguration string, see Configuration Strings. No values currently permitted.
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int com.wiredtiger.db.Connection.configure_method ( String  method,
String  uri,
String  config,
String  type,
String  check 
)

Add configuration options for a method.

See Creating data-specific configuration strings for more information.

/*
* Applications opening a cursor for the data-source object "my_data"
* have an additional configuration option "entries", which is an
* integer type, defaults to 5, and must be an integer between 1 and 10.
*/
ret = conn->configure_method(conn,
"session.open_cursor",
"my_data:", "entries=5", "int", "min=1,max=10");
/*
* Applications opening a cursor for the data-source object "my_data"
* have an additional configuration option "devices", which is a list
* of strings.
*/
ret = conn->configure_method(conn,
"session.open_cursor", "my_data:", "devices", "list", NULL);
Parameters
connectionthe connection handle
methodthe name of the method
urithe object type or NULL for all object types
configthe additional configuration's name and default value
typethe additional configuration's type (must be one of "boolean"\, "int", "list" or "string")
checkthe additional configuration check string, or NULL if none
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int com.wiredtiger.db.Connection.is_new ( )

Return if opening this handle created the database.

if (conn->is_new(conn)) {
/* First time initialization. */
}
Parameters
connectionthe connection handle
Returns
false (zero) if the connection existed before the call to wiredtiger_open, true (non-zero) if it was created by opening this handle.
int com.wiredtiger.db.Connection.load_extension ( String  path,
String  config 
)

Load an extension.

ret = conn->load_extension(conn, "my_extension.dll", NULL);
ret = conn->load_extension(conn,
"datasource/libdatasource.so",
"config=[device=/dev/sd1,alignment=64]");
Parameters
connectionthe connection handle
paththe filename of the extension module
configConfiguration string, see Configuration Strings. Permitted values:
NameEffectValues
configconfiguration string passed to the entry point of the extension as its WT_CONFIG_ARG argument.a string; default empty.
entrythe entry point of the extension, called to initialize the extension when it is loaded. The signature of the function must match wiredtiger_extension_init.a string; default wiredtiger_extension_init.
terminatean optional function in the extension that is called before the extension is unloaded during WT_CONNECTION::close. The signature of the function must match wiredtiger_extension_terminate.a string; default wiredtiger_extension_terminate.
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.
int com.wiredtiger.db.Connection.reconfigure ( String  config)

Reconfigure a connection handle.

ret = conn->reconfigure(conn, "eviction_target=75");
Parameters
connectionthe connection handle
configConfiguration string, see Configuration Strings. Permitted values:
NameEffectValues
cache_sizemaximum heap memory to allocate for the cache. A database should configure either a cache_size or a shared_cache not both.an integer between 1MB and 10TB; default 100MB.
error_prefixprefix string for error messages.a string; default empty.
eviction_dirty_targetcontinue evicting until the cache has less dirty pages than this (as a percentage). Dirty pages will only be evicted if the cache is full enough to trigger eviction.an integer between 10 and 99; default 80.
eviction_targetcontinue evicting until the cache becomes less full than this (as a percentage). Must be less than eviction_trigger.an integer between 10 and 99; default 80.
eviction_triggertrigger eviction when the cache becomes this full (as a percentage).an integer between 10 and 99; default 95.
shared_cache = (shared cache configuration options. A database should configure either a cache_size or a shared_cache not both.a set of related configuration options defined below.
    enablewhether the connection is using a shared cache.a boolean flag; default false.
    chunkthe granularity that a shared cache is redistributed.an integer between 1MB and 10TB; default 10MB.
    reserveamount of cache this database is guaranteed to have available from the shared cache. This setting is per database. Defaults to the chunk size.an integer; default 0.
    namename of a cache that is shared between databases.a string; default pool.
    sizemaximum memory to allocate for the shared cache. Setting this will update the value if one is already set.an integer between 1MB and 10TB; default 500MB.
)
statisticsMaintain database statistics, which may impact performance. Choosing "all" maintains all statistics regardless of cost, "fast" maintains a subset of statistics that are relatively inexpensive, "none" turns off all statistics. The "clear" configuration resets statistics after they are gathered, where appropriate (for example, a cache size statistic is not cleared, while the count of cursor insert operations will be cleared). When "clear" is configured for the database, gathered statistics are reset each time a statistics cursor is used to gather statistics, as well as each time statistics are logged using the statistics_log configuration. See Statistics for more information.a list, with values chosen from the following options: "all", "fast", "none", "clear"; default none.
verboseenable messages for various events. Options are given as a list, such as "verbose=[evictserver,read]".a list, with values chosen from the following options: "block", "ckpt", "compact", "evict", "evictserver", "fileops", "hazard", "log", "lsm", "mutex", "overflow", "read", "readserver", "reconcile", "recovery", "salvage", "shared_cache", "verify", "version", "write"; default empty.
Returns
zero on success and a non-zero error code on failure. See Error Returns for details.