Package de.chojo.sqlutil.jdbc
Class RemoteJdbcConfig<T extends RemoteJdbcConfig<?>>
java.lang.Object
de.chojo.sqlutil.jdbc.JdbcConfig<T>
de.chojo.sqlutil.jdbc.RemoteJdbcConfig<T>
- Direct Known Subclasses:
MariaDbJdbc,MySQLJdbc,PostgresJdbc
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbaseUrl()Returns the base url without parameterSets the database for the connection.Set the host name of the connectionSets the host to an ipv4 address.Sets the host to an ipv6 address.Sets the host explicit to local host.Sets the password for the connection.port(int port) Set the port.Set the port.Sets the user for the connection.Methods inherited from class de.chojo.sqlutil.jdbc.JdbcConfig
addParameter, defaultDriverClass, driver, driverClass, jdbcUrl, parameter, self, setDriverClass, setDriverClass, setDriverClass
-
Constructor Details
-
RemoteJdbcConfig
public RemoteJdbcConfig()
-
-
Method Details
-
localhost
Sets the host explicit to local host.This is usually the default value defined by jdbc drivers.
- Returns:
- builder instance
-
host
Set the host name of the connection- Parameters:
host- host- Returns:
- builder instance
-
ipv4
Sets the host to an ipv4 address. This address must be a valid ipv4 address- Parameters:
ipv4- ipv4 address- Returns:
- builder instance
- Throws:
IllegalArgumentException- when an invalid ipv4 was passed
-
ipv6
Sets the host to an ipv6 address.This address must be a valid ipv6 address.
The method will ensure that the ipv6 address is surrounded by [...], which is required by jdbc.
- Parameters:
ipv6- ipv6 address- Returns:
- builder instance
- Throws:
IllegalArgumentException- when an invalid ipv6 was passed
-
port
Set the port.- Parameters:
port- port- Returns:
- builder instance
- Throws:
IllegalArgumentException- when the port is not a numberIllegalArgumentException- when the port is smaller than 1 or larger than 65535
-
port
Set the port.- Parameters:
port- port- Returns:
- builder instance
- Throws:
IllegalArgumentException- when the port is smaller than 1 or larger than 65535
-
database
Sets the database for the connection.Most drivers default to the username if not entered.
- Parameters:
database- database- Returns:
- builder instance
-
baseUrl
Description copied from class:JdbcConfigReturns the base url without parameter- Specified by:
baseUrlin classJdbcConfig<T extends RemoteJdbcConfig<?>>- Returns:
- base url
-
login
-
password
Sets the password for the connection.- Parameters:
password- password- Returns:
- builder instance
-
user
Sets the user for the connection.- Parameters:
user- user- Returns:
- builder instance
-