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

public final Class UcanaccessDriver

extends Object
implements Driver
Class Inheritance
All Implemented Interfaces
java.sql.Driver
Annotations
@SuppressWarnings:java:S4925
Static Imports
net.ucanaccess.converters.Metadata.Property.*

Field Summary

Modifier and TypeField and Description
private static final System.Logger
public static final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
acceptsURL(String url)

Implements java.sql.Driver.acceptsURL.

Retrieves whether the driver thinks that it can open a connection to the given URL.

public Connection
connect(String url, Properties props)

Implements java.sql.Driver.connect.

Attempts to make a database connection to the given URL.

public int
getMajorVersion()

Implements java.sql.Driver.getMajorVersion.

Retrieves the driver's major version number.

public int
getMinorVersion()

Implements java.sql.Driver.getMinorVersion.

Gets the driver's minor version number.

public java.util.logging.Logger
getParentLogger()

Implements java.sql.Driver.getParentLogger.

Return the parent Logger of all the Loggers used by this driver.

public DriverPropertyInfo[]
getPropertyInfo(String url, Properties arg1)

Implements java.sql.Driver.getPropertyInfo.

Gets information about the possible properties for this driver.

public boolean
jdbcCompliant()

Implements java.sql.Driver.jdbcCompliant.

Reports whether this driver is a genuine JDBC Compliant driver.

private IJackcessOpenerInterface

Returns:

a new instance of the given class
newJackcessOpenerInstance
(String
fully qualified name of a class implementing IJackcessOpenerInterface
className
)

Loads the class with the given name and instantiates it via its public no-arg constructor, provided it implements IJackcessOpenerInterface.

pack-priv static Map<Metadata.Property, String>

Returns:

map of unknown and normalized properties
readProperties
(Properties
input properties
input
,
String
driver url
url
,
BiConsumer<String, String>
consumer of unknown property key/value
unknownConsumer
)

Normalizes properties received as input and found in the driver url and returns a map of typed properties.

private Integer
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

LOGGERback to summary
private static final System.Logger LOGGER
URL_PREFIXback to summary
public static final String URL_PREFIX

Constructor Detail

UcanaccessDriverback to summary
public UcanaccessDriver()

Method Detail

acceptsURLback to summary
public boolean acceptsURL(String url)

Implements java.sql.Driver.acceptsURL.

Doc from java.sql.Driver.acceptsURL.

Retrieves whether the driver thinks that it can open a connection to the given URL. Typically drivers will return true if they understand the sub-protocol specified in the URL and false if they do not.

Annotations
@Override
connectback to summary
public Connection connect(String url, Properties props) throws SQLException

Implements java.sql.Driver.connect.

Doc from java.sql.Driver.connect.

Attempts to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn.

The driver should throw an SQLException if it is the right driver to connect to the given URL but has trouble connecting to the database.

The Properties argument can be used to pass arbitrary string tag/value pairs as connection arguments. Normally at least "user" and "password" properties should be included in the Properties object.

Note

If a property is specified as part of the url and is also specified in the Properties object, it is implementation-defined as to which value will take precedence. For maximum portability, an application should only specify a property once.

Annotations
@Override
@SuppressWarnings:java:S2095
Exceptions
SQLException:
if a database access error occurs or the url is null
getMajorVersionback to summary
public int getMajorVersion()

Implements java.sql.Driver.getMajorVersion.

Doc from java.sql.Driver.getMajorVersion.

Retrieves the driver's major version number. Initially this should be 1.

Annotations
@Override
getMinorVersionback to summary
public int getMinorVersion()

Implements java.sql.Driver.getMinorVersion.

Doc from java.sql.Driver.getMinorVersion.

Gets the driver's minor version number. Initially this should be 0.

Annotations
@Override
getParentLoggerback to summary
public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException

Implements java.sql.Driver.getParentLogger.

Doc from java.sql.Driver.getParentLogger.

Return the parent Logger of all the Loggers used by this driver. This should be the Logger farthest from the root Logger that is still an ancestor of all of the Loggers used by this driver. Configuring this Logger will affect all of the log messages generated by the driver. In the worst case, this may be the root Logger.

Annotations
@Override
Exceptions
SQLFeatureNotSupportedException:
if the driver does not use java.util.logging.
getPropertyInfoback to summary
public DriverPropertyInfo[] getPropertyInfo(String url, Properties arg1)

Implements java.sql.Driver.getPropertyInfo.

Doc from java.sql.Driver.getPropertyInfo.

Gets information about the possible properties for this driver.

The getPropertyInfo method is intended to allow a generic GUI tool to discover what properties it should prompt a human for in order to get enough information to connect to a database. Note that depending on the values the human has supplied so far, additional values may become necessary, so it may be necessary to iterate though several calls to the getPropertyInfo method.

Annotations
@Override
jdbcCompliantback to summary
public boolean jdbcCompliant()

Implements java.sql.Driver.jdbcCompliant.

Doc from java.sql.Driver.jdbcCompliant.

Reports whether this driver is a genuine JDBC Compliant driver. A driver may only report true here if it passes the JDBC compliance tests; otherwise it is required to return false.

JDBC compliance requires full support for the JDBC API and full support for SQL 92 Entry Level. It is expected that JDBC compliant drivers will be available for all the major commercial databases.

This method is not intended to encourage the development of non-JDBC compliant drivers, but is a recognition of the fact that some vendors are interested in using the JDBC API and framework for lightweight databases that do not support full database functionality, or for special databases such as document information retrieval where a SQL implementation may not be feasible.

Annotations
@Override
newJackcessOpenerInstanceback to summary
private IJackcessOpenerInterface newJackcessOpenerInstance(String className) throws UcanaccessSQLException

Loads the class with the given name and instantiates it via its public no-arg constructor, provided it implements IJackcessOpenerInterface.

Security Note

className must only ever originate from trusted, static application configuration (see the jackcessOpener connection property). It must never be built from untrusted or user-supplied input, since this method executes the no-arg constructor of whatever class is named, and any class implementing IJackcessOpenerInterface that is reachable on the classpath will pass the type check regardless of what its constructor does.

Parameters
className:String

fully qualified name of a class implementing IJackcessOpenerInterface

Returns:IJackcessOpenerInterface

a new instance of the given class

Exceptions
UcanaccessSQLException:
if the class cannot be loaded, does not implement IJackcessOpenerInterface, or cannot be instantiated via its no-arg constructor
readPropertiesback to summary
pack-priv static Map<Metadata.Property, String> readProperties(Properties input, String url, BiConsumer<String, String> unknownConsumer)

Normalizes properties received as input and found in the driver url and returns a map of typed properties.
The method differentiates between known and unknown properties by return known properties as typed properties with their value and calling an optional consumer for each property key and value.
If a property is found multiple times or found in both, the input properties as well as in the driver url, the url has precedence over the input properties and the latest occurrence overall will be used.

Parameters
input:Properties

input properties

url:String

driver url

unknownConsumer:BiConsumer<String, String>

consumer of unknown property key/value

Returns:Map<Metadata.Property, String>

map of unknown and normalized properties

validateLobScaleback to summary
private Integer validateLobScale(String property)