java.lang.Object
bayern.steinbrecher.dbConnector.DBConnection
bayern.steinbrecher.dbConnector.SshConnection
- All Implemented Interfaces:
java.lang.AutoCloseable
public final class SshConnection extends DBConnection
- Since:
- 0.1
-
Nested Class Summary
Nested classes/interfaces inherited from class bayern.steinbrecher.dbConnector.DBConnection
DBConnection.Column<T>, DBConnection.Table<T,E> -
Constructor Summary
Constructors Constructor Description SshConnection(@NotNull SupportedDatabases dbms, @NotNull java.lang.String databaseHost, int databasePort, @NotNull java.lang.String databaseName, @NotNull java.lang.String sshHost, int sshPort, @NotNull java.nio.charset.Charset sshCharset, @NotNull SshCredentials credentials) -
Method Summary
Modifier and Type Method Description voidclose()@NotNull java.util.List<java.util.List<java.lang.String>>execQuery(@NotNull java.lang.String sqlCode)Executes a query and returns the result.voidexecUpdate(@NotNull java.lang.String sqlCode)Executes a command like INSERT INTO, UPDATE or CREATE.Methods inherited from class bayern.steinbrecher.dbConnector.DBConnection
createTableIfNotExists, databaseExists, getAllColumns, getAllTables, getDatabaseName, getDbms, getMissingColumns, getTable, getTableContent, tableExists
-
Constructor Details
-
SshConnection
public SshConnection(@NotNull @NotNull SupportedDatabases dbms, @NotNull @NotNull java.lang.String databaseHost, int databasePort, @NotNull @NotNull java.lang.String databaseName, @NotNull @NotNull java.lang.String sshHost, int sshPort, @NotNull @NotNull java.nio.charset.Charset sshCharset, @NotNull @NotNull SshCredentials credentials) throws AuthException, java.net.UnknownHostException, UnsupportedDatabaseException- Throws:
AuthExceptionjava.net.UnknownHostExceptionUnsupportedDatabaseException- Since:
- 0.1
-
-
Method Details
-
execQuery
@NotNull public @NotNull java.util.List<java.util.List<java.lang.String>> execQuery(@NotNull @NotNull java.lang.String sqlCode) throws QueryFailedExceptionDescription copied from class:DBConnectionExecutes a query and returns the result.- Specified by:
execQueryin classDBConnection- Parameters:
sqlCode- The sql code to execute.- Returns:
- Table containing the results AND the headings of each column. First dimension rows; second columns.
- Throws:
QueryFailedException- Thrown if the sql code is invalid.- Since:
- 0.1
-
execUpdate
Description copied from class:DBConnectionExecutes a command like INSERT INTO, UPDATE or CREATE.- Specified by:
execUpdatein classDBConnection- Parameters:
sqlCode- The sql code to execute.- Throws:
QueryFailedException- Thrown if the sql code is invalid.- Since:
- 0.1
-
close
public void close()- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein classDBConnection- Since:
- 0.1
-