Package me.ahoo.cosid.store.jdbc
Class JdbcDialects
java.lang.Object
me.ahoo.cosid.store.jdbc.JdbcDialects
The built-in
JdbcDialects (06-stores.md ยง2.1) and the detection of the dialect of a database.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final JdbcDialectH2 2.x, for development and tests.static final JdbcDialectMariaDB 10.11 LTS and later.static final JdbcDialectMySQL 8.4 LTS and later.static final JdbcDialectPostgreSQL 15 and later.static final JdbcDialectSQL Server 2019 and later. -
Method Summary
Modifier and TypeMethodDescriptionstatic List<JdbcDialect> available(ClassLoader classLoader) The dialects to choose from: those registered withServiceLoaderfirst, then the built-in ones.static JdbcDialectdetect(Connection connection, ClassLoader classLoader) The first ofavailable(java.lang.ClassLoader)that supports the database of the connection.static Optional<JdbcDialect> named(String name, ClassLoader classLoader) The dialect of the given name amongavailable(java.lang.ClassLoader), ignoring case.
-
Field Details
-
MYSQL
MySQL 8.4 LTS and later. -
MARIADB
MariaDB 10.11 LTS and later. -
POSTGRESQL
PostgreSQL 15 and later. -
SQL_SERVER
SQL Server 2019 and later. -
H2
H2 2.x, for development and tests.
-
-
Method Details
-
available
The dialects to choose from: those registered withServiceLoaderfirst, then the built-in ones.- Parameters:
classLoader- the class loader of theServiceLoaderlookup- Returns:
- the dialects
-
named
The dialect of the given name amongavailable(java.lang.ClassLoader), ignoring case.- Parameters:
name- the name, such asmysqlclassLoader- the class loader of theServiceLoaderlookup- Returns:
- the dialect, if there is one of this name
-
detect
public static JdbcDialect detect(Connection connection, ClassLoader classLoader) throws SQLException The first ofavailable(java.lang.ClassLoader)that supports the database of the connection.- Parameters:
connection- a connection to the databaseclassLoader- the class loader of theServiceLoaderlookup- Returns:
- the dialect
- Throws:
SQLException- if the metadata cannot be readIllegalArgumentException- if no dialect supports the database
-