APIdia Launch Partner
Top Inners Fields Constructors Methods
net.ucanaccess.jdbc

public final Class DBReference

extends Object
Class Inheritance
Imports
io.github.spannm.jackcess.Database, .Database.FileFormat, .DatabaseBuilder, .DateTimeType, .Row, .Table, .Table.ColumnOrder, net.ucanaccess.converters.LoadJet, .Metadata, net.ucanaccess.exception.UcanaccessSQLException, java.io.File, .IOException, .RandomAccessFile, java.lang.System.Logger, .System.Logger.Level, java.nio.channels.FileLock, java.nio.charset.Charset, java.nio.file.AccessDeniedException, java.sql.Connection, .DriverManager, .ResultSet, .SQLException, .Statement, java.time.LocalDateTime, .ZoneId, java.time.format.DateTimeFormatter, java.util.ArrayList, .Arrays, .Date, .HashMap, .HashSet, .List, .Locale, .Map, .Optional, .Set, .Timer, .TimerTask, .UUID, java.util.concurrent.atomic.AtomicInteger, java.util.stream.Collectors, .Stream

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
DBReference.UniqueString

Unique string based on current date/time and a unique id.

Field Summary

Modifier and TypeField and Description
private boolean
allowRemoteLinks

Whether the io.github.spannm.jackcess.util.LinkResolver registered below may automatically resolve linked tables that point to a network/UNC path.

private Charset
private static final String
private boolean
private boolean
private final File
private Database.FileFormat
private Database
private boolean
private String
private Map<String, String>
private FileLock
private boolean
private boolean
private String
private boolean
private boolean
private boolean
private final IJackcessOpenerInterface
private long
private final Set<File>
private Integer
private final System.Logger
private final DBReference.MemoryTimer
private File
private boolean
private boolean
private static final String
private static final String
private static final String
private static List<IOnReloadReferenceListener>
private boolean
private final Map<String, Table>
pinnedAutoNumberTables

Holds strong references to Table instances on which a caller has explicitly toggled allowAutoNumberInsert (via DISABLE/ENABLE AUTOINCREMENT ON).

private boolean
private final String
private boolean
private boolean
private boolean
private boolean
private boolean
private File
private File
private static String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static boolean
private boolean
private boolean
pack-priv Connection
private void
private void
closeHsqlDb(Session session, boolean firstConnectionKeeptMirror)

private String
public void
private File
private long
private void
pack-priv File
public Database
public Connection
private List<File>
private String
pack-priv String
public long
private String
private long
public File
public static String
public void
private void
private static synchronized void
public static boolean
public boolean
public boolean
public boolean
public boolean
pack-priv static boolean

Returns:

true if the path is a network/UNC path, false otherwise
isNetworkPath
(String
the linked database path as stored in the Access database file
fileName
)

Determines whether the given linked database path is a network/UNC path, e.g. \\server\share\db.accdb, //server/share/db.accdb or a device-style UNC path such as \\?\UNC\server\share\db.accdb.

public boolean
public boolean
pack-priv boolean
pack-priv boolean
pack-priv boolean
private void
public Database
open(File dbfl, String password)

pack-priv void
pinAutoNumberTable(String tableName, Table table)

Pins the given table so it is not garbage-collected while an explicit allowAutoNumberInsert toggle (from DISABLE/ENABLE AUTOINCREMENT ON) is in effect on it.

public void
public void
public void
public void
setConcatNulls(boolean concatNulls)

public void
setEncryptHSQLDB(boolean encryptHSQLDB)

public void
setExternalResourcesMapping(Map<String, String> externalResourcesMapping)

private void
public void
setIgnoreCase(boolean ignoreCase)

public void
setImmediatelyReleaseResources(boolean immediatelyReleaseResources)

public void
setInactivityTimeout(int inactivityTimeout)

public void
setInMemory(boolean inMemory)

public void
setLobScale(Integer lobScale)

public void
setMirrorFolder(File mirrorFolder)

public void
setMirrorReadOnly(boolean mirrorReadOnly)

public void
setOpenExclusive(boolean openExclusive)

public void
setPreventReloading(boolean preventReloading)

public void
setShowSchema(boolean showSchema)

public void
setSkipIndexes(boolean skipIndexes)

public void
setSysSchema(boolean sysSchema)

public void
setToKeepHsql(File toKeepHsql)

pack-priv void
shutdown(Session session)

public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

charsetback to summary
private Charset charset
CIPHER_SPECback to summary
private static final String CIPHER_SPEC
columnOrderDisplayback to summary
private boolean columnOrderDisplay
concatNullsback to summary
private boolean concatNulls
dbFileback to summary
private final File dbFile
dbFormatback to summary
private Database.FileFormat dbFormat
dbIOback to summary
private Database dbIO
encryptHSQLDBback to summary
private boolean encryptHSQLDB
encryptionKeyback to summary
private String encryptionKey
externalResourcesMappingback to summary
private Map<String, String> externalResourcesMapping
fileLockback to summary
private FileLock fileLock
firstConnectionback to summary
private boolean firstConnection
hsqldbShutdownback to summary
private boolean hsqldbShutdown
idback to summary
private String id
ignoreCaseback to summary
private boolean ignoreCase
immediatelyReleaseResourcesback to summary
private boolean immediatelyReleaseResources
inMemoryback to summary
private boolean inMemory
jkoback to summary
private final IJackcessOpenerInterface jko
lastModifiedback to summary
private long lastModified
lobScaleback to summary
private Integer lobScale
loggerback to summary
private final System.Logger logger
memoryTimerback to summary
private final DBReference.MemoryTimer memoryTimer
mirrorFolderback to summary
private File mirrorFolder
mirrorReadOnlyback to summary
private boolean mirrorReadOnly
mirrorRecreatedback to summary
private boolean mirrorRecreated
MSG_COULD_NOT_CREATEback to summary
private static final String MSG_COULD_NOT_CREATE
MSG_COULD_NOT_DELETEback to summary
private static final String MSG_COULD_NOT_DELETE
MSG_CREATED_FILEback to summary
private static final String MSG_CREATED_FILE
onReloadListenersback to summary
private static List<IOnReloadReferenceListener> onReloadListeners
openExclusiveback to summary
private boolean openExclusive
pinnedAutoNumberTablesback to summary
private final Map<String, Table> pinnedAutoNumberTables

Holds strong references to Table instances on which a caller has explicitly toggled allowAutoNumberInsert (via DISABLE/ENABLE AUTOINCREMENT ON). Jackcess's internal table cache only holds Table objects via WeakReferences, so without this pin the GC could collect such a table between statements; the table would then be transparently reloaded on next access, silently resetting allowAutoNumberInsert to its default and losing the toggle.

preventReloadingback to summary
private boolean preventReloading
pwdback to summary
private final String pwd
readOnlyback to summary
private boolean readOnly
readOnlyFileFormatback to summary
private boolean readOnlyFileFormat
showSchemaback to summary
private boolean showSchema
skipIndexesback to summary
private boolean skipIndexes
sysSchemaback to summary
private boolean sysSchema
tempHsqlback to summary
private File tempHsql
toKeepHsqlback to summary
private File toKeepHsql
versionback to summary
private static String version

Constructor Detail

DBReferenceback to summary
public DBReference(File fl, Database.FileFormat ff, IJackcessOpenerInterface jko, final String pwd, Charset charset) throws IOException

Method Detail

addOnReloadRefListenerback to summary
public static boolean addOnReloadRefListener(IOnReloadReferenceListener action)
checkInsideback to summary
private boolean checkInside(Database db) throws IOException
checkInsideback to summary
private boolean checkInside() throws IOException
checkLastModifiedback to summary
pack-priv Connection checkLastModified(Connection conn, Session session) throws UcanaccessSQLException
closeHsqlDbback to summary
private void closeHsqlDb(Session session) throws IOException
closeHsqlDbback to summary
private void closeHsqlDb(Session session, boolean firstConnectionKeeptMirror) throws IOException
createIdback to summary
private String createId()
decrementActiveConnectionback to summary
public void decrementActiveConnection(Session session)
fileLockback to summary
private File fileLock()
filesUpdateTimeback to summary
private long filesUpdateTime()
finalizeHsqlDbback to summary
private void finalizeHsqlDb(Session session) throws IOException
getDbFileback to summary
pack-priv File getDbFile()
getDbIOback to summary
public Database getDbIO()
getHSQLDBConnectionback to summary
public Connection getHSQLDBConnection(Session session) throws SQLException
getHSQLDBFilesback to summary
private List<File> getHSQLDBFiles()
getHsqlUrlback to summary
private String getHsqlUrl(Session session) throws SQLException
getIdback to summary
pack-priv String getId()
getInactivityTimeoutback to summary
public long getInactivityTimeout()
getKeyback to summary
private String getKey() throws SQLException
getLastUpdateHSQLDBback to summary
private long getLastUpdateHSQLDB()
getToKeepHsqlback to summary
public File getToKeepHsql()
getVersionback to summary
public static String getVersion()
incrementActiveConnectionback to summary
public void incrementActiveConnection()
initHSQLDBback to summary
private void initHSQLDB(Connection conn)
initVersionback to summary
private static synchronized void initVersion(Connection conn) throws SQLException
is2xxback to summary
public static boolean is2xx()
isConcatNullsback to summary
public boolean isConcatNulls()
isEncryptHSQLDBback to summary
public boolean isEncryptHSQLDB()
isIgnoreCaseback to summary
public boolean isIgnoreCase()
isInMemoryback to summary
public boolean isInMemory()
isNetworkPathback to summary
pack-priv static boolean isNetworkPath(String fileName)

Determines whether the given linked database path is a network/UNC path, e.g. \\server\share\db.accdb, //server/share/db.accdb or a device-style UNC path such as \\?\UNC\server\share\db.accdb.

Such paths are excluded from automatic resolution by default since they let an untrusted Access database file trigger an outbound network connection (see allowRemoteLinks).

Parameters
fileName:String

the linked database path as stored in the Access database file

Returns:boolean

true if the path is a network/UNC path, false otherwise

isPreventReloadingback to summary
public boolean isPreventReloading()
isReadOnlyback to summary
public boolean isReadOnly() throws UcanaccessSQLException
isReadOnlyFileFormatback to summary
pack-priv boolean isReadOnlyFileFormat()
isShowSchemaback to summary
pack-priv boolean isShowSchema()
loadedFromKeptMirrorback to summary
pack-priv boolean loadedFromKeptMirror(Session session) throws UcanaccessSQLException
lockMdbFileback to summary
private void lockMdbFile() throws UcanaccessSQLException
openback to summary
public Database open(File dbfl, String password) throws IOException
pinAutoNumberTableback to summary
pack-priv void pinAutoNumberTable(String tableName, Table table)

Pins the given table so it is not garbage-collected while an explicit allowAutoNumberInsert toggle (from DISABLE/ENABLE AUTOINCREMENT ON) is in effect on it.

releaseLockback to summary
public void releaseLock() throws IOException
reloadDbIOback to summary
public void reloadDbIO() throws IOException
setColumnOrderDisplayback to summary
public void setColumnOrderDisplay()
setConcatNullsback to summary
public void setConcatNulls(boolean concatNulls)
setEncryptHSQLDBback to summary
public void setEncryptHSQLDB(boolean encryptHSQLDB)
setExternalResourcesMappingback to summary
public void setExternalResourcesMapping(Map<String, String> externalResourcesMapping)
setIgnoreCaseback to summary
private void setIgnoreCase(Connection conn)
setIgnoreCaseback to summary
public void setIgnoreCase(boolean ignoreCase)
setImmediatelyReleaseResourcesback to summary
public void setImmediatelyReleaseResources(boolean immediatelyReleaseResources)
setInactivityTimeoutback to summary
public void setInactivityTimeout(int inactivityTimeout)
setInMemoryback to summary
public void setInMemory(boolean inMemory)
setLobScaleback to summary
public void setLobScale(Integer lobScale)
setMirrorFolderback to summary
public void setMirrorFolder(File mirrorFolder)
setMirrorReadOnlyback to summary
public void setMirrorReadOnly(boolean mirrorReadOnly)
setOpenExclusiveback to summary
public void setOpenExclusive(boolean openExclusive)
setPreventReloadingback to summary
public void setPreventReloading(boolean preventReloading)
setShowSchemaback to summary
public void setShowSchema(boolean showSchema)
setSkipIndexesback to summary
public void setSkipIndexes(boolean skipIndexes)
setSysSchemaback to summary
public void setSysSchema(boolean sysSchema)
setToKeepHsqlback to summary
public void setToKeepHsql(File toKeepHsql)
shutdownback to summary
pack-priv void shutdown(Session session) throws Exception
updateLastModifiedback to summary
public void updateLastModified()
net.ucanaccess.jdbc back to summary

private Class DBReference.MemoryTimer

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private final DBReference
private static final long
private long
private long
private final System.Logger
private final Timer

Constructor Summary

AccessConstructor and Description
pack-priv
MemoryTimer(DBReference dbReference)

Method Summary

Modifier and TypeMethod and Description
pack-priv synchronized void
pack-priv synchronized int
pack-priv synchronized long
pack-priv synchronized void
pack-priv void
setInactivityTimeout(int inactivityTimeout)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activeConnectionback to summary
private int activeConnection
dbReferenceback to summary
private final DBReference dbReference
INACTIVITY_TIMEOUT_DEFAULTback to summary
private static final long INACTIVITY_TIMEOUT_DEFAULT
inactivityTimeoutback to summary
private long inactivityTimeout
lastConnectionTimeback to summary
private long lastConnectionTime
loggerback to summary
private final System.Logger logger
timerback to summary
private final Timer timer

Constructor Detail

MemoryTimerback to summary
pack-priv MemoryTimer(DBReference dbReference)

Method Detail

decrementActiveConnectionback to summary
pack-priv synchronized void decrementActiveConnection(final Session session)
getActiveConnectionback to summary
pack-priv synchronized int getActiveConnection()
getLastConnectionTimeback to summary
pack-priv synchronized long getLastConnectionTime()
incrementActiveConnectionback to summary
pack-priv synchronized void incrementActiveConnection()
setInactivityTimeoutback to summary
pack-priv void setInactivityTimeout(int inactivityTimeout)
net.ucanaccess.jdbc back to summary

private final Class DBReference.UniqueString

extends Object
Class Inheritance

Unique string based on current date/time and a unique id.

Field Summary

Modifier and TypeField and Description
private static final AtomicInteger
private static final DateTimeFormatter
private final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

COUNTERback to summary
private static final AtomicInteger COUNTER
FORMATTERback to summary
private static final DateTimeFormatter FORMATTER
nameback to summary
private final String name

Constructor Detail

UniqueStringback to summary
private UniqueString()

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override