@Deprecated public final class ConnectionsExtensions extends Object
ConnectionsExtensions
have convenience methods to create and connect to mysql,
H2 or postgresql databases.Modifier and Type | Field and Description |
---|---|
static String |
H2_DRIVERNAME
Deprecated.
Constant for the drivername from H2-database.
|
static String |
H2_PREFIX_URL
Deprecated.
Constant for the urlprefix from H2-database.
|
static String |
MYSQL_DRIVERNAME
Deprecated.
Constant for the drivername from MySQL-database.
|
static int |
MYSQL_PORT
Deprecated.
Constant for the default port where the MySQL-database listen.
|
static String |
MYSQL_PREFIX_URL
Deprecated.
Constant for the urlprefix from MySQL-database.
|
static String |
POSTGRESQL_DRIVERNAME
Deprecated.
Constant for the drivername from PostgreSQL-database.
|
static int |
POSTGRESQL_PORT
Deprecated.
Constant for the port where the PostgreSQL-database listen.
|
static String |
POSTGRESQL_PREFIX_URL
Deprecated.
Constant for the urlprefix from PostgreSQL-database.
|
Constructor and Description |
---|
ConnectionsExtensions()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static void |
dropPostgreSQLDatabase(String hostname,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Drops the given PostgreSQL database with the given databaseName if it does exist.
|
static void |
executeSqlScript(BufferedReader bufferedReader,
Connection connection)
Deprecated.
Execute the sql script in the given BufferedReader from a file.
|
static void |
executeSqlScript(BufferedReader bufferedReader,
Connection connection,
boolean log)
Deprecated.
Execute the sql script in the given BufferedReader from a file.
|
static void |
executeSqlScript(Connection connection,
String sqlScript)
Deprecated.
Execute the sql script given as String object.
|
static void |
executeSqlScript(Connection connection,
String sqlScript,
boolean log)
Deprecated.
Execute the sql script given as String object.
|
static boolean |
existsMySqlDatabase(String hostname,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Checks if the given database exists in the MySqlDatabase.
|
static boolean |
existsPostgreSQLDatabase(String hostname,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Checks if the given database exists in the Postgresql Database.
|
static Connection |
getH2Connection(String path,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Gets the H2 connection.
|
static Connection |
getMySQLConnection(String hostname,
int portNumber,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Gets the my sql connection.
|
static Connection |
getMySQLConnection(String hostname,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Gets the my sql connection.
|
static Connection |
getPostgreSQLConnection(String hostname,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Gets the postgre sql connection.
|
static Connection |
getPostgresSQLConnection(String hostname,
int portNumber,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Gets the postgres sql connection from the given parameters.
|
static void |
newMySqlDatabase(String hostname,
String databaseName,
String dbuser,
String dbpasswort)
Deprecated.
Creates a database with the given databaseName (and sets the characterset to utf8 and the
collate to utf8_general_ci) if it does not exist.
|
static void |
newMySqlDatabase(String hostname,
String databaseName,
String dbuser,
String dbpasswort,
String characterSet,
String collate)
Deprecated.
Creates the a mySql database with the given databaseName if it does not exist.
|
static void |
newPostgreSQLDatabase(String hostname,
String databaseName,
String dbuser,
String dbpasswort,
String characterSet,
String collate)
Deprecated.
Creates the a PostgreSQL database with the given databaseName if it does not exist.
|
public static final String H2_DRIVERNAME
public static final String H2_PREFIX_URL
public static final String MYSQL_DRIVERNAME
public static final String MYSQL_PREFIX_URL
public static final int MYSQL_PORT
public static final String POSTGRESQL_DRIVERNAME
public static final String POSTGRESQL_PREFIX_URL
public static final int POSTGRESQL_PORT
public static void dropPostgreSQLDatabase(String hostname, String databaseName, String dbuser, String dbpasswort) throws SQLException, ClassNotFoundException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortSQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionClassNotFoundException
- is thrown if the Class was not found or could not be locatedpublic static void executeSqlScript(BufferedReader bufferedReader, Connection connection) throws IOException, SQLException
bufferedReader
- a BufferedReader from a script file.connection
- the connectionIOException
- Signals that an I/O exception has occurred.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static void executeSqlScript(BufferedReader bufferedReader, Connection connection, boolean log) throws IOException, SQLException
bufferedReader
- a BufferedReader from a script file.connection
- the connectionlog
- the flag if it will be logged.IOException
- Signals that an I/O exception has occurred.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static void executeSqlScript(Connection connection, String sqlScript) throws SQLException
sqlScript
- The sql script as String object.connection
- the connectionSQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static void executeSqlScript(Connection connection, String sqlScript, boolean log) throws SQLException
sqlScript
- The sql script as String object.connection
- the connectionlog
- the flag if it will be logged.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static boolean existsMySqlDatabase(String hostname, String databaseName, String dbuser, String dbpasswort) throws SQLException, ClassNotFoundException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortSQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionClassNotFoundException
- is thrown if the Class was not found or could not be located.public static boolean existsPostgreSQLDatabase(String hostname, String databaseName, String dbuser, String dbpasswort) throws ClassNotFoundException, SQLException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortClassNotFoundException
- is thrown if the Class was not found or could not be located.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static Connection getH2Connection(String path, String databaseName, String dbuser, String dbpasswort) throws ClassNotFoundException, SQLException
path
- the pathdatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortClassNotFoundException
- is thrown if the Class was not found or could not be located.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static Connection getMySQLConnection(String hostname, int portNumber, String databaseName, String dbuser, String dbpasswort) throws ClassNotFoundException, SQLException
hostname
- the hostnameportNumber
- the port numberdatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortClassNotFoundException
- is thrown if the Class was not found or could not be located.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static Connection getMySQLConnection(String hostname, String databaseName, String dbuser, String dbpasswort) throws ClassNotFoundException, SQLException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortClassNotFoundException
- is thrown if the Class was not found or could not be located.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static Connection getPostgreSQLConnection(String hostname, String databaseName, String dbuser, String dbpasswort) throws ClassNotFoundException, SQLException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortClassNotFoundException
- is thrown if the Class was not found or could not be located.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static Connection getPostgresSQLConnection(String hostname, int portNumber, String databaseName, String dbuser, String dbpasswort) throws ClassNotFoundException, SQLException
hostname
- the hostnameportNumber
- the port numberdatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortClassNotFoundException
- is thrown if the Class was not found or could not be located.SQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionpublic static void newMySqlDatabase(String hostname, String databaseName, String dbuser, String dbpasswort) throws SQLException, ClassNotFoundException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortSQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionClassNotFoundException
- is thrown if the Class was not found or could not be located.public static void newMySqlDatabase(String hostname, String databaseName, String dbuser, String dbpasswort, String characterSet, String collate) throws SQLException, ClassNotFoundException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortcharacterSet
- the character setcollate
- the collateSQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionClassNotFoundException
- is thrown if the Class was not found or could not be located.public static void newPostgreSQLDatabase(String hostname, String databaseName, String dbuser, String dbpasswort, String characterSet, String collate) throws SQLException, ClassNotFoundException
hostname
- the hostnamedatabaseName
- the database namedbuser
- the dbuserdbpasswort
- the dbpasswortcharacterSet
- the character setcollate
- the collateSQLException
- is thrown if a database access error occurs or this method is called on a closed
connectionClassNotFoundException
- is thrown if the Class was not found or could not be located.Copyright © 2015–2019 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.