Class GenericJDBCDriver
java.lang.Object
ortus.boxlang.runtime.jdbc.drivers.GenericJDBCDriver
- All Implemented Interfaces:
IJDBCDriver
This is the generic JDBC driver that can be used to register datasources in the system.
We use a generic JDBC Url connection schema to connect to the database.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IStruct
The default custom params for the connection URL These are attached to the connection URL as query parameters according to the driver's requirements.protected String
The default delimiter for the custom parametersprotected String
A default host for the connection URL, if needed.protected String
A default port for the connection URL, if needed.protected IStruct
The default configuration properties.protected String
The class name of the driver, useful metadataprotected Key
The unique name of the driverprotected DatabaseDriverType
The driver type according to BoxLang standards -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildConnectionURL
(DatasourceConfig config) Get the connection JDBC URL according to the driver type.This helper method is used to convert the custom parameters in the config (Key.custom) to a query string that can be used by the driver to build the connection URL.We return an empty class, because we are using a generic JDBC driver that does not have a specific class name.Get default custom parameters for the driver to incorporate into the datasource configGet the default delimiter for the custom parametersGet the default host for the driverGet the default port for the driverGet default properties for the driver to incorporate into the datasource configgetName()
-------------------------------------------------------------------------- Interface Methods --------------------------------------------------------------------------getType()
Get the driver type
-
Field Details
-
name
The unique name of the driver -
type
The driver type according to BoxLang standards -
driverClassName
The class name of the driver, useful metadata -
defaultDelimiter
The default delimiter for the custom parameters -
defaultPort
A default port for the connection URL, if needed. Null by default. -
defaultHost
A default host for the connection URL, if needed. Localhost by default. -
defaultCustomParams
The default custom params for the connection URL These are attached to the connection URL as query parameters according to the driver's requirements. -
defaultProperties
The default configuration properties. These are attached to the datasource configuration as properties Which can be used by our Connection Pool: HikariCP
-
-
Constructor Details
-
GenericJDBCDriver
public GenericJDBCDriver()Constructor
-
-
Method Details
-
getName
-------------------------------------------------------------------------- Interface Methods --------------------------------------------------------------------------- Specified by:
getName
in interfaceIJDBCDriver
-
getType
Description copied from interface:IJDBCDriver
Get the driver type- Specified by:
getType
in interfaceIJDBCDriver
-
getClassName
We return an empty class, because we are using a generic JDBC driver that does not have a specific class name.This will be based on the connection url built by the driver and it will be expecting the class to be in the class path.
Custom parameters are incorporated by the
DatasourceConfig
object automatically.- Specified by:
getClassName
in interfaceIJDBCDriver
-
buildConnectionURL
Description copied from interface:IJDBCDriver
Get the connection JDBC URL according to the driver type. The driver implementation should be able to build the connection URL- Specified by:
buildConnectionURL
in interfaceIJDBCDriver
-
getDefaultProperties
Get default properties for the driver to incorporate into the datasource config- Specified by:
getDefaultProperties
in interfaceIJDBCDriver
-
getDefaultCustomParams
Get default custom parameters for the driver to incorporate into the datasource config- Specified by:
getDefaultCustomParams
in interfaceIJDBCDriver
-
getDefaultPort
Get the default port for the driver- Returns:
- The default port
-
getDefaultHost
Get the default host for the driver- Returns:
- The default host
-
getDefaultDelimiter
Get the default delimiter for the custom parameters- Returns:
- The default delimiter
-
customParamsToQueryString
This helper method is used to convert the custom parameters in the config (Key.custom) to a query string that can be used by the driver to build the connection URL.We incorporate the default parameters into the custom parameters and return the query string using the driver's default delimiter.
- Parameters:
config
- The datasource config- Returns:
- The custom parameters as a query string
-