com.healthmarketscience.jackcess
Class Database

java.lang.Object
  extended by com.healthmarketscience.jackcess.Database
All Implemented Interfaces:
Closeable, Flushable, Iterable<Table>

public class Database
extends Object
implements Iterable<Table>, Closeable, Flushable

An Access database.

There is optional support for large indexes (enabled by default). This optional support can be disabled via a few different means:

Author:
Tim McCune
Usage:
General: This class is general use.

Nested Class Summary
static class Database.FileFormat
          Enum which indicates which version of Access created the database.
 
Field Summary
static String BROKEN_NIO_PROPERTY
          (boolean) system property which can be used to indicate that the current vm has a poor nio implementation (specifically for FileChannel.transferFrom)
static String CHARSET_PROPERTY_PREFIX
          system property prefix which can be used to set the default Charset used for text data (full property includes the JetFormat version).
static String COLUMN_ORDER_PROPERTY
          system property which can be used to set the default sort order for table columns.
static boolean DEFAULT_AUTO_SYNC
          default value for the auto-sync value (true).
static Table.ColumnOrder DEFAULT_COLUMN_ORDER
          the default sort order for table columns.
static ErrorHandler DEFAULT_ERROR_HANDLER
          default error handler used if none provided (just rethrows exception)
static LinkResolver DEFAULT_LINK_RESOLVER
          default link resolver used if none provided
static String DEFAULT_RESOURCE_PATH
          the default value for the resource path used to load classpath resources.
static String FK_ENFORCE_PROPERTY
          system property which can be used to set the default enforcement of foreign-key relationships.
static String RESOURCE_PATH_PROPERTY
          system property which can be used to set the path from which classpath resources are loaded (must end with a "/" if non-empty).
static String TIMEZONE_PROPERTY
          system property which can be used to set the default TimeZone used for date calculations.
static String USE_BIG_INDEX_PROPERTY
          (boolean) system property which can be used to disable the default big index support.
 
Method Summary
 void close()
          Close the database file (and any linked databases)
 String copyTable(String name, ResultSet source)
          Copy an existing JDBC ResultSet into a new table in this database
 String copyTable(String name, ResultSet source, ImportFilter filter)
          Copy an existing JDBC ResultSet into a new table in this database
static Database create(Database.FileFormat fileFormat, File mdbFile)
          Create a new Database for the given fileFormat
static Database create(Database.FileFormat fileFormat, File mdbFile, boolean autoSync)
          Create a new Database for the given fileFormat
static Database create(Database.FileFormat fileFormat, File mdbFile, boolean autoSync, Charset charset, TimeZone timeZone)
          Create a new Database for the given fileFormat
static Database create(File mdbFile)
          Create a new Access 2000 Database
static Database create(File mdbFile, boolean autoSync)
          Create a new Access 2000 Database
 void createLinkedTable(String name, String linkedDbName, String linkedTableName)
          Create a new table in this database
 void createTable(String name, List<Column> columns)
          Create a new table in this database
 void createTable(String name, List<Column> columns, List<IndexBuilder> indexes)
          Create a new table in this database
 boolean defaultUseBigIndex()
          Returns false if "big index support" has been disabled explicity on the this Database or via a system property, true otherwise.
 boolean doUseBigIndex()
          Whether or not big index support is enabled for tables.
static String escapeIdentifier(String s)
           
 void flush()
          Flushes any current changes to the database file (and any linked databases) to disk.
 Table getAccessControlEntries()
           
 Charset getCharset()
          Gets currently configured Charset (always non-null).
 Table.ColumnOrder getColumnOrder()
          Gets currently configured Table.ColumnOrder (always non-null).
 String getDatabasePassword()
           
 PropertyMap getDatabaseProperties()
           
static Charset getDefaultCharset(JetFormat format)
          Returns the default Charset for the given JetFormat.
 short getDefaultCodePage()
           
static Table.ColumnOrder getDefaultColumnOrder()
          Returns the default Table.ColumnOrder.
static boolean getDefaultEnforceForeignKeys()
          Returns the default enforce foreign-keys policy.
 Column.SortOrder getDefaultSortOrder()
           
static TimeZone getDefaultTimeZone()
          Returns the default TimeZone.
 ErrorHandler getErrorHandler()
          Gets the currently configured ErrorHandler (always non-null).
 File getFile()
          Returns the File underlying this Database
 Database.FileFormat getFileFormat()
          Returns the FileFormat of this database (which may involve inspecting the database itself).
 JetFormat getFormat()
           
 Map<String,Database> getLinkedDatabases()
          Returns an unmodifiable view of the currently loaded linked databases, mapped from the linked database file name to the linked database.
 LinkResolver getLinkResolver()
          Gets the currently configured LinkResolver (always non-null).
 PageChannel getPageChannel()
           
 PropertyMaps getPropertiesForObject(int objectId)
           
 List<Query> getQueries()
          Finds all the queries in the database.
 List<Relationship> getRelationships(Table table1, Table table2)
          Finds all the relationships in the database between the given tables.
 PropertyMap getSummaryProperties()
           
 Table getSystemCatalog()
           
 Table getSystemComplexColumns()
           
 Table getSystemTable(String tableName)
          Returns a reference to any available table in this access database, including system tables.
 Set<String> getSystemTableNames()
           
 Table getTable(int tableDefPageNumber)
           
 Table getTable(String name)
           
 Table getTable(String name, boolean useBigIndex)
           
 Set<String> getTableNames()
           
 TimeZone getTimeZone()
          Gets currently configured TimeZone (always non-null).
 PropertyMap getUserDefinedProperties()
           
 String importFile(String name, File f, String delim)
          Copy a delimited text file into a new table in this database
 String importFile(String name, File f, String delim, ImportFilter filter)
          Copy a delimited text file into a new table in this database
 String importReader(String name, BufferedReader in, String delim)
          Copy a delimited text file into a new table in this database
 String importReader(String name, BufferedReader in, String delim, ImportFilter filter)
          Copy a delimited text file into a new table in this database
 boolean isEnforceForeignKeys()
          Gets currently foreign-key enforcement policy.
static boolean isReservedWord(String s)
           
 Iterator<Table> iterator()
           
static Database open(File mdbFile)
          Open an existing Database.
static Database open(File mdbFile, boolean readOnly)
          Open an existing Database.
static Database open(File mdbFile, boolean readOnly, boolean autoSync)
          Open an existing Database.
static Database open(File mdbFile, boolean readOnly, boolean autoSync, Charset charset, TimeZone timeZone)
          Open an existing Database.
static Database open(File mdbFile, boolean readOnly, boolean autoSync, Charset charset, TimeZone timeZone, CodecProvider provider)
          Open an existing Database.
 PropertyMaps readProperties(byte[] propsBytes, int objectId)
           
 void setCharset(Charset newCharset)
          Sets a new Charset.
 void setColumnOrder(Table.ColumnOrder newColumnOrder)
          Sets a new Table.ColumnOrder.
 void setEnforceForeignKeys(Boolean newEnforceForeignKeys)
          Sets a new foreign-key enforcement policy.
 void setErrorHandler(ErrorHandler newErrorHandler)
          Sets a new ErrorHandler.
 void setLinkResolver(LinkResolver newLinkResolver)
          Sets a new LinkResolver.
 void setTimeZone(TimeZone newTimeZone)
          Sets a new TimeZone.
 void setUseBigIndex(boolean useBigIndex)
          Set whether or not big index support is enabled for tables.
 String toString()
           
static void validateIdentifierName(String name, int maxLength, String identifierType)
          Validates an identifier name.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_AUTO_SYNC

public static final boolean DEFAULT_AUTO_SYNC
default value for the auto-sync value (true). this is slower, but leaves more chance of a useable database in the face of failures.

See Also:
Constant Field Values
Usage:
General: This field is general use.

DEFAULT_RESOURCE_PATH

public static final String DEFAULT_RESOURCE_PATH
the default value for the resource path used to load classpath resources.

See Also:
Constant Field Values
Usage:
General: This field is general use.

DEFAULT_COLUMN_ORDER

public static final Table.ColumnOrder DEFAULT_COLUMN_ORDER
the default sort order for table columns.

Usage:
Intermediate: This field requires moderate API knowledge.

USE_BIG_INDEX_PROPERTY

public static final String USE_BIG_INDEX_PROPERTY
(boolean) system property which can be used to disable the default big index support.

See Also:
Constant Field Values
Usage:
General: This field is general use.

TIMEZONE_PROPERTY

public static final String TIMEZONE_PROPERTY
system property which can be used to set the default TimeZone used for date calculations.

See Also:
Constant Field Values
Usage:
General: This field is general use.

CHARSET_PROPERTY_PREFIX

public static final String CHARSET_PROPERTY_PREFIX
system property prefix which can be used to set the default Charset used for text data (full property includes the JetFormat version).

See Also:
Constant Field Values
Usage:
General: This field is general use.

RESOURCE_PATH_PROPERTY

public static final String RESOURCE_PATH_PROPERTY
system property which can be used to set the path from which classpath resources are loaded (must end with a "/" if non-empty). Default value is DEFAULT_RESOURCE_PATH if unspecified.

See Also:
Constant Field Values
Usage:
General: This field is general use.

BROKEN_NIO_PROPERTY

public static final String BROKEN_NIO_PROPERTY
(boolean) system property which can be used to indicate that the current vm has a poor nio implementation (specifically for FileChannel.transferFrom)

See Also:
Constant Field Values
Usage:
Intermediate: This field requires moderate API knowledge.

COLUMN_ORDER_PROPERTY

public static final String COLUMN_ORDER_PROPERTY
system property which can be used to set the default sort order for table columns. Value should be one Table.ColumnOrder enum values.

See Also:
Constant Field Values
Usage:
Intermediate: This field requires moderate API knowledge.

FK_ENFORCE_PROPERTY

public static final String FK_ENFORCE_PROPERTY
system property which can be used to set the default enforcement of foreign-key relationships. Defaults to false.

See Also:
Constant Field Values
Usage:
General: This field is general use.

DEFAULT_ERROR_HANDLER

public static final ErrorHandler DEFAULT_ERROR_HANDLER
default error handler used if none provided (just rethrows exception)

Usage:
General: This field is general use.

DEFAULT_LINK_RESOLVER

public static final LinkResolver DEFAULT_LINK_RESOLVER
default link resolver used if none provided

Usage:
General: This field is general use.
Method Detail

open

public static Database open(File mdbFile)
                     throws IOException
Open an existing Database. If the existing file is not writeable, the file will be opened read-only. Auto-syncing is enabled for the returned Database.

Equivalent to: open(mdbFile, false);

Parameters:
mdbFile - File containing the database
Throws:
IOException
See Also:
open(File,boolean), for more flexible Database opening
Usage:
General: This method is general use.

open

public static Database open(File mdbFile,
                            boolean readOnly)
                     throws IOException
Open an existing Database. If the existing file is not writeable or the readOnly flag is true, the file will be opened read-only. Auto-syncing is enabled for the returned Database.

Equivalent to: open(mdbFile, readOnly, DEFAULT_AUTO_SYNC);

Parameters:
mdbFile - File containing the database
readOnly - iff true, force opening file in read-only mode
Throws:
IOException
See Also:
open(File,boolean,boolean), for more flexible Database opening
Usage:
General: This method is general use.

open

public static Database open(File mdbFile,
                            boolean readOnly,
                            boolean autoSync)
                     throws IOException
Open an existing Database. If the existing file is not writeable or the readOnly flag is true, the file will be opened read-only.

Parameters:
mdbFile - File containing the database
readOnly - iff true, force opening file in read-only mode
autoSync - whether or not to enable auto-syncing on write. if true, writes will be immediately flushed to disk. This leaves the database in a (fairly) consistent state on each write, but can be very inefficient for many updates. if false, flushing to disk happens at the jvm's leisure, which can be much faster, but may leave the database in an inconsistent state if failures are encountered during writing. Writes may be flushed at any time using flush().
Throws:
IOException
See Also:
for more flexible Database opening
Usage:
General: This method is general use.

open

public static Database open(File mdbFile,
                            boolean readOnly,
                            boolean autoSync,
                            Charset charset,
                            TimeZone timeZone)
                     throws IOException
Open an existing Database. If the existing file is not writeable or the readOnly flag is true, the file will be opened read-only.

Parameters:
mdbFile - File containing the database
readOnly - iff true, force opening file in read-only mode
autoSync - whether or not to enable auto-syncing on write. if true, writes will be immediately flushed to disk. This leaves the database in a (fairly) consistent state on each write, but can be very inefficient for many updates. if false, flushing to disk happens at the jvm's leisure, which can be much faster, but may leave the database in an inconsistent state if failures are encountered during writing. Writes may be flushed at any time using flush().
charset - Charset to use, if null, uses default
timeZone - TimeZone to use, if null, uses default
Throws:
IOException
See Also:
for more flexible Database opening
Usage:
Intermediate: This method requires moderate API knowledge.

open

public static Database open(File mdbFile,
                            boolean readOnly,
                            boolean autoSync,
                            Charset charset,
                            TimeZone timeZone,
                            CodecProvider provider)
                     throws IOException
Open an existing Database. If the existing file is not writeable or the readOnly flag is true, the file will be opened read-only.

Parameters:
mdbFile - File containing the database
readOnly - iff true, force opening file in read-only mode
autoSync - whether or not to enable auto-syncing on write. if true, writes will be immediately flushed to disk. This leaves the database in a (fairly) consistent state on each write, but can be very inefficient for many updates. if false, flushing to disk happens at the jvm's leisure, which can be much faster, but may leave the database in an inconsistent state if failures are encountered during writing. Writes may be flushed at any time using flush().
charset - Charset to use, if null, uses default
timeZone - TimeZone to use, if null, uses default
provider - CodecProvider for handling page encoding/decoding, may be null if no special encoding is necessary
Throws:
IOException
See Also:
for more flexible Database opening
Usage:
Intermediate: This method requires moderate API knowledge.

create

public static Database create(File mdbFile)
                       throws IOException
Create a new Access 2000 Database

Equivalent to: create(FileFormat.V2000, mdbFile, DEFAULT_AUTO_SYNC);

Parameters:
mdbFile - Location to write the new database to. If this file already exists, it will be overwritten.
Throws:
IOException
See Also:
create(File,boolean), for more flexible Database creation
Usage:
General: This method is general use.

create

public static Database create(Database.FileFormat fileFormat,
                              File mdbFile)
                       throws IOException
Create a new Database for the given fileFormat

Equivalent to: create(fileFormat, mdbFile, DEFAULT_AUTO_SYNC);

Parameters:
fileFormat - version of new database.
mdbFile - Location to write the new database to. If this file already exists, it will be overwritten.
Throws:
IOException
See Also:
create(File,boolean), for more flexible Database creation
Usage:
General: This method is general use.

create

public static Database create(File mdbFile,
                              boolean autoSync)
                       throws IOException
Create a new Access 2000 Database

Equivalent to: create(FileFormat.V2000, mdbFile, DEFAULT_AUTO_SYNC);

Parameters:
mdbFile - Location to write the new database to. If this file already exists, it will be overwritten.
autoSync - whether or not to enable auto-syncing on write. if true, writes will be immediately flushed to disk. This leaves the database in a (fairly) consistent state on each write, but can be very inefficient for many updates. if false, flushing to disk happens at the jvm's leisure, which can be much faster, but may leave the database in an inconsistent state if failures are encountered during writing. Writes may be flushed at any time using flush().
Throws:
IOException
See Also:
for more flexible Database creation
Usage:
General: This method is general use.

create

public static Database create(Database.FileFormat fileFormat,
                              File mdbFile,
                              boolean autoSync)
                       throws IOException
Create a new Database for the given fileFormat

Parameters:
fileFormat - version of new database.
mdbFile - Location to write the new database to. If this file already exists, it will be overwritten.
autoSync - whether or not to enable auto-syncing on write. if true, writes will be immediately flushed to disk. This leaves the database in a (fairly) consistent state on each write, but can be very inefficient for many updates. if false, flushing to disk happens at the jvm's leisure, which can be much faster, but may leave the database in an inconsistent state if failures are encountered during writing. Writes may be flushed at any time using flush().
Throws:
IOException
See Also:
for more flexible Database creation
Usage:
General: This method is general use.

create

public static Database create(Database.FileFormat fileFormat,
                              File mdbFile,
                              boolean autoSync,
                              Charset charset,
                              TimeZone timeZone)
                       throws IOException
Create a new Database for the given fileFormat

Parameters:
fileFormat - version of new database.
mdbFile - Location to write the new database to. If this file already exists, it will be overwritten.
autoSync - whether or not to enable auto-syncing on write. if true, writes will be immediately flushed to disk. This leaves the database in a (fairly) consistent state on each write, but can be very inefficient for many updates. if false, flushing to disk happens at the jvm's leisure, which can be much faster, but may leave the database in an inconsistent state if failures are encountered during writing. Writes may be flushed at any time using flush().
charset - Charset to use, if null, uses default
timeZone - TimeZone to use, if null, uses default
Throws:
IOException
See Also:
for more flexible Database creation
Usage:
Intermediate: This method requires moderate API knowledge.

getFile

public File getFile()
Returns the File underlying this Database


getPageChannel

public PageChannel getPageChannel()
Usage:
Advanced: This method is for advanced/internal use.

getFormat

public JetFormat getFormat()
Usage:
Advanced: This method is for advanced/internal use.

getSystemCatalog

public Table getSystemCatalog()
Returns:
The system catalog table
Usage:
Advanced: This method is for advanced/internal use.

getAccessControlEntries

public Table getAccessControlEntries()
                              throws IOException
Returns:
The system Access Control Entries table (loaded on demand)
Throws:
IOException
Usage:
Advanced: This method is for advanced/internal use.

getSystemComplexColumns

public Table getSystemComplexColumns()
                              throws IOException
Returns:
the complex column system table (loaded on demand)
Throws:
IOException
Usage:
Advanced: This method is for advanced/internal use.

doUseBigIndex

public boolean doUseBigIndex()
Whether or not big index support is enabled for tables.

Usage:
Advanced: This method is for advanced/internal use.

setUseBigIndex

public void setUseBigIndex(boolean useBigIndex)
Set whether or not big index support is enabled for tables.

Usage:
Intermediate: This method requires moderate API knowledge.

getErrorHandler

public ErrorHandler getErrorHandler()
Gets the currently configured ErrorHandler (always non-null). This will be used to handle all errors unless overridden at the Table or Cursor level.

Usage:
Intermediate: This method requires moderate API knowledge.

setErrorHandler

public void setErrorHandler(ErrorHandler newErrorHandler)
Sets a new ErrorHandler. If null, resets to the DEFAULT_ERROR_HANDLER.

Usage:
Intermediate: This method requires moderate API knowledge.

getLinkResolver

public LinkResolver getLinkResolver()
Gets the currently configured LinkResolver (always non-null). This will be used to handle all linked database loading.

Usage:
Intermediate: This method requires moderate API knowledge.

setLinkResolver

public void setLinkResolver(LinkResolver newLinkResolver)
Sets a new LinkResolver. If null, resets to the DEFAULT_LINK_RESOLVER.

Usage:
Intermediate: This method requires moderate API knowledge.

getLinkedDatabases

public Map<String,Database> getLinkedDatabases()
Returns an unmodifiable view of the currently loaded linked databases, mapped from the linked database file name to the linked database. This information may be useful for implementing a LinkResolver.

Usage:
Intermediate: This method requires moderate API knowledge.

getTimeZone

public TimeZone getTimeZone()
Gets currently configured TimeZone (always non-null).

Usage:
Intermediate: This method requires moderate API knowledge.

setTimeZone

public void setTimeZone(TimeZone newTimeZone)
Sets a new TimeZone. If null, resets to the value returned by getDefaultTimeZone().

Usage:
Intermediate: This method requires moderate API knowledge.

getCharset

public Charset getCharset()
Gets currently configured Charset (always non-null).

Usage:
Intermediate: This method requires moderate API knowledge.

setCharset

public void setCharset(Charset newCharset)
Sets a new Charset. If null, resets to the value returned by getDefaultCharset(com.healthmarketscience.jackcess.JetFormat).

Usage:
Intermediate: This method requires moderate API knowledge.

getColumnOrder

public Table.ColumnOrder getColumnOrder()
Gets currently configured Table.ColumnOrder (always non-null).

Usage:
Intermediate: This method requires moderate API knowledge.

setColumnOrder

public void setColumnOrder(Table.ColumnOrder newColumnOrder)
Sets a new Table.ColumnOrder. If null, resets to the value returned by getDefaultColumnOrder().

Usage:
Intermediate: This method requires moderate API knowledge.

isEnforceForeignKeys

public boolean isEnforceForeignKeys()
Gets currently foreign-key enforcement policy.

Usage:
Intermediate: This method requires moderate API knowledge.

setEnforceForeignKeys

public void setEnforceForeignKeys(Boolean newEnforceForeignKeys)
Sets a new foreign-key enforcement policy. If null, resets to the value returned by isEnforceForeignKeys().

Usage:
Intermediate: This method requires moderate API knowledge.

getFileFormat

public Database.FileFormat getFileFormat()
                                  throws IOException
Returns the FileFormat of this database (which may involve inspecting the database itself).

Throws:
IllegalStateException - if the file format cannot be determined
IOException
Usage:
General: This method is general use.

getDefaultSortOrder

public Column.SortOrder getDefaultSortOrder()
                                     throws IOException
Returns:
the currently configured database default language sort order for textual columns
Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

getDefaultCodePage

public short getDefaultCodePage()
                         throws IOException
Returns:
the currently configured database default code page for textual data (may not be relevant to all database versions)
Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

readProperties

public PropertyMaps readProperties(byte[] propsBytes,
                                   int objectId)
                            throws IOException
Returns:
a PropertyMaps instance decoded from the given bytes (always returns non-null result).
Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

getTableNames

public Set<String> getTableNames()
                          throws IOException
Returns:
The names of all of the user tables (String)
Throws:
IOException
Usage:
General: This method is general use.

getSystemTableNames

public Set<String> getSystemTableNames()
                                throws IOException
Returns:
The names of all of the system tables (String). Note, in order to read these tables, you must use getSystemTable(java.lang.String). Extreme care should be taken if modifying these tables directly!.
Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

iterator

public Iterator<Table> iterator()
Specified by:
iterator in interface Iterable<Table>
Returns:
an unmodifiable Iterator of the user Tables in this Database.
Throws:
IllegalStateException - if an IOException is thrown by one of the operations, the actual exception will be contained within
ConcurrentModificationException - if a table is added to the database while an Iterator is in use.
Usage:
General: This method is general use.

getTable

public Table getTable(String name)
               throws IOException
Parameters:
name - Table name
Returns:
The table, or null if it doesn't exist
Throws:
IOException
Usage:
General: This method is general use.

getTable

public Table getTable(String name,
                      boolean useBigIndex)
               throws IOException
Parameters:
name - Table name
useBigIndex - whether or not "big index support" should be enabled for the table (this value will override any other settings)
Returns:
The table, or null if it doesn't exist
Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

getTable

public Table getTable(int tableDefPageNumber)
               throws IOException
Parameters:
tableDefPageNumber - the page number of a table definition
Returns:
The table, or null if it doesn't exist
Throws:
IOException
Usage:
Advanced: This method is for advanced/internal use.

createTable

public void createTable(String name,
                        List<Column> columns)
                 throws IOException
Create a new table in this database

Parameters:
name - Name of the table to create
columns - List of Columns in the table
Throws:
IOException
Usage:
General: This method is general use.

createTable

public void createTable(String name,
                        List<Column> columns,
                        List<IndexBuilder> indexes)
                 throws IOException
Create a new table in this database

Parameters:
name - Name of the table to create
columns - List of Columns in the table
indexes - List of IndexBuilders describing indexes for the table
Throws:
IOException
Usage:
General: This method is general use.

createLinkedTable

public void createLinkedTable(String name,
                              String linkedDbName,
                              String linkedTableName)
                       throws IOException
Create a new table in this database

Parameters:
name - Name of the table to create
Throws:
IOException
Usage:
General: This method is general use.

getRelationships

public List<Relationship> getRelationships(Table table1,
                                           Table table2)
                                    throws IOException
Finds all the relationships in the database between the given tables.

Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

getQueries

public List<Query> getQueries()
                       throws IOException
Finds all the queries in the database.

Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

getSystemTable

public Table getSystemTable(String tableName)
                     throws IOException
Returns a reference to any available table in this access database, including system tables.

Warning, this method is not designed for common use, only for the occassional time when access to a system table is necessary. Messing with system tables can strip the paint off your house and give your whole family a permanent, orange afro. You have been warned.

Parameters:
tableName - Table name, may be a system table
Returns:
The table, or null if it doesn't exist
Throws:
IOException
Usage:
Intermediate: This method requires moderate API knowledge.

getDatabaseProperties

public PropertyMap getDatabaseProperties()
                                  throws IOException
Returns:
the core properties for the database
Throws:
IOException
Usage:
General: This method is general use.

getSummaryProperties

public PropertyMap getSummaryProperties()
                                 throws IOException
Returns:
the summary properties for the database
Throws:
IOException
Usage:
General: This method is general use.

getUserDefinedProperties

public PropertyMap getUserDefinedProperties()
                                     throws IOException
Returns:
the user-defined properties for the database
Throws:
IOException
Usage:
General: This method is general use.

getPropertiesForObject

public PropertyMaps getPropertiesForObject(int objectId)
                                    throws IOException
Returns:
the PropertyMaps for the object with the given id
Throws:
IOException
Usage:
Advanced: This method is for advanced/internal use.

getDatabasePassword

public String getDatabasePassword()
                           throws IOException
Returns:
the current database password, or null if none set.
Throws:
IOException
Usage:
General: This method is general use.

copyTable

public String copyTable(String name,
                        ResultSet source)
                 throws SQLException,
                        IOException
Copy an existing JDBC ResultSet into a new table in this database

Parameters:
name - Name of the new table to create
source - ResultSet to copy from
Returns:
the name of the copied table
Throws:
SQLException
IOException
See Also:
ImportUtil.importResultSet(ResultSet,Database,String)
Usage:
General: This method is general use.

copyTable

public String copyTable(String name,
                        ResultSet source,
                        ImportFilter filter)
                 throws SQLException,
                        IOException
Copy an existing JDBC ResultSet into a new table in this database

Parameters:
name - Name of the new table to create
source - ResultSet to copy from
filter - valid import filter
Returns:
the name of the imported table
Throws:
SQLException
IOException
See Also:
ImportUtil.importResultSet(ResultSet,Database,String,ImportFilter)
Usage:
General: This method is general use.

importFile

public String importFile(String name,
                         File f,
                         String delim)
                  throws IOException
Copy a delimited text file into a new table in this database

Parameters:
name - Name of the new table to create
f - Source file to import
delim - Regular expression representing the delimiter string.
Returns:
the name of the imported table
Throws:
IOException
See Also:
ImportUtil.importFile(File,Database,String,String)
Usage:
General: This method is general use.

importFile

public String importFile(String name,
                         File f,
                         String delim,
                         ImportFilter filter)
                  throws IOException
Copy a delimited text file into a new table in this database

Parameters:
name - Name of the new table to create
f - Source file to import
delim - Regular expression representing the delimiter string.
filter - valid import filter
Returns:
the name of the imported table
Throws:
IOException
See Also:
ImportUtil.importFile(File,Database,String,String,ImportFilter)
Usage:
General: This method is general use.

importReader

public String importReader(String name,
                           BufferedReader in,
                           String delim)
                    throws IOException
Copy a delimited text file into a new table in this database

Parameters:
name - Name of the new table to create
in - Source reader to import
delim - Regular expression representing the delimiter string.
Returns:
the name of the imported table
Throws:
IOException
See Also:
ImportUtil.importReader(BufferedReader,Database,String,String)
Usage:
General: This method is general use.

importReader

public String importReader(String name,
                           BufferedReader in,
                           String delim,
                           ImportFilter filter)
                    throws IOException
Copy a delimited text file into a new table in this database

Parameters:
name - Name of the new table to create
in - Source reader to import
delim - Regular expression representing the delimiter string.
filter - valid import filter
Returns:
the name of the imported table
Throws:
IOException
See Also:
ImportUtil.importReader(BufferedReader,Database,String,String,ImportFilter)
Usage:
General: This method is general use.

flush

public void flush()
           throws IOException
Flushes any current changes to the database file (and any linked databases) to disk.

Specified by:
flush in interface Flushable
Throws:
IOException
Usage:
General: This method is general use.

close

public void close()
           throws IOException
Close the database file (and any linked databases)

Specified by:
close in interface Closeable
Throws:
IOException
Usage:
General: This method is general use.

escapeIdentifier

public static String escapeIdentifier(String s)
Returns:
A table or column name escaped for Access
Usage:
General: This method is general use.

isReservedWord

public static boolean isReservedWord(String s)
Returns:
true if the given string is a reserved word, false otherwise
Usage:
General: This method is general use.

validateIdentifierName

public static void validateIdentifierName(String name,
                                          int maxLength,
                                          String identifierType)
Validates an identifier name.

Usage:
Advanced: This method is for advanced/internal use.

toString

public String toString()
Overrides:
toString in class Object

defaultUseBigIndex

public boolean defaultUseBigIndex()
Returns false if "big index support" has been disabled explicity on the this Database or via a system property, true otherwise.

Usage:
Advanced: This method is for advanced/internal use.

getDefaultTimeZone

public static TimeZone getDefaultTimeZone()
Returns the default TimeZone. This is normally the platform default TimeZone as returned by TimeZone.getDefault(), but can be overridden using the system property "com.healthmarketscience.jackcess.timeZone".

Usage:
Advanced: This method is for advanced/internal use.

getDefaultCharset

public static Charset getDefaultCharset(JetFormat format)
Returns the default Charset for the given JetFormat. This may or may not be platform specific, depending on the format, but can be overridden using a system property composed of the prefix "com.healthmarketscience.jackcess.charset." followed by the JetFormat version to which the charset should apply, e.g. "com.healthmarketscience.jackcess.charset.VERSION_3".

Usage:
Advanced: This method is for advanced/internal use.

getDefaultColumnOrder

public static Table.ColumnOrder getDefaultColumnOrder()
Returns the default Table.ColumnOrder. This defaults to DEFAULT_COLUMN_ORDER, but can be overridden using the system property "com.healthmarketscience.jackcess.columnOrder".

Usage:
Advanced: This method is for advanced/internal use.

getDefaultEnforceForeignKeys

public static boolean getDefaultEnforceForeignKeys()
Returns the default enforce foreign-keys policy. This defaults to false, but can be overridden using the system property "com.healthmarketscience.jackcess.enforceForeignKeys".

Usage:
Advanced: This method is for advanced/internal use.


Copyright © 2005-2013 Health Market Science. All Rights Reserved.