Package nz.co.gregs.dbvolution.databases
Class JavaDBMemoryDB
- java.lang.Object
-
- nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
-
- nz.co.gregs.dbvolution.databases.JavaDBMemoryDB
-
- All Implemented Interfaces:
Serializable
,AutoCloseable
,Cloneable
,DBDatabase
public class JavaDBMemoryDB extends DBDatabaseImplementation
Use this class to work with an in-memory JavaDB.Support DBvolution at Patreon
- Author:
- gregory.graham
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
DBDatabaseImplementation.ResponseToException, DBDatabaseImplementation.RunRegularProcessors
-
-
Field Summary
Fields Modifier and Type Field Description static String
DRIVER_NAME
static long
serialVersionUID
-
Fields inherited from class nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
storedConnection
-
-
Constructor Summary
Constructors Constructor Description JavaDBMemoryDB(String host, int port, String database, String username, String password)
Creates or connects to a JavaDB in-memory instance.JavaDBMemoryDB(String jdbcURL, String username, String password)
Creates a new JavaDB instance that will connect to the JDBC URL using the username and password supplied..JavaDBMemoryDB(DataSource dataSource)
Creates a new JavaDB instance that will connect to the DataSource.JavaDBMemoryDB(JavaDBMemorySettingsBuilder settings)
Creates a new JavaDB instance that will connect to the DataSource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDatabaseSpecificFeatures(Statement statement)
Used By Subclasses To Inject Datatypes, Functions, Etc Into the Database.JavaDBMemoryDB
clone()
Clones the DBDatabase.Integer
getDefaultPort()
Returns the port number usually assign to instances of this database.JavaDBMemorySettingsBuilder
getURLInterpreter()
boolean
isMemoryDatabase()
-
Methods inherited from interface nz.co.gregs.dbvolution.databases.DBDatabase
getCount, getDBMigration, getRows, print, test
-
Methods inherited from class nz.co.gregs.dbvolution.databases.DBDatabaseImplementation
addFeatureToFixException, addRegularProcess, backupToDBDatabase, batchSQLStatementsWhenPossible, checkMetaDataForTable, checkTableExistsViaQuery, close, commitTransaction, copy, createForeignKeyConstraints, createIndexesOnAllFields, createOrUpdateTable, createTable, createTable, createTableNoExceptions, createTableNoExceptions, createTablesNoExceptions, createTablesNoExceptions, createTablesWithForeignKeysNoExceptions, createTableWithForeignKeys, delete, delete, deleteAllRowsFromTable, discardConnection, doReadOnlyTransaction, doTransaction, doTransaction, doTransactionWithoutCompleting, dropDatabase, dropDatabase, dropTable, dropTableIfExists, dropTableNoExceptions, equals, executeDBAction, executeDBQuery, get, get, get, get, get, getAllRows, getBaseDBDatabaseClass, getBatchSQLStatementsWhenPossible, getByExample, getByExample, getByExamples, getConnection, getConnectionFromDriverManager, getCount, getCurrentInstant, getCurrentLocalDatetime, getDatabaseInstance, getDatabaseName, getDatabaseSpecificDBConnection, getDataSource, getDBDatabaseMetaData, getDBQuery, getDBQuery, getDBQuery, getDBQuery, getDBQueryInsert, getDBRecursiveQuery, getDBStatement, getDBTable, getDBTransactionStatement, getDefinition, getDriverName, getExtras, getHost, getJdbcURL, getLabel, getLastException, getLowLevelStatement, getPassword, getPort, getPreventAccidentalDroppingOfDatabases, getPreventAccidentalDroppingOfTables, getPrintSQLBeforeExecuting, getQuietExceptionsPreference, getRegularProcessors, getRegularThreadPool, getSchema, getSettings, getSettingsFromJDBCURL, getSQLForDBQuery, getUrlFromSettings, getUsername, handleErrorDuringExecutingSQL, hasCreatedRequiredTables, hashCode, implement, initDatabase, insert, insert, insert, insertOrUpdate, insertOrUpdate, isDBDatabaseCluster, isPrintSQLBeforeExecuting, preventAccidentalDDLDuringTransaction, preventAccidentalDeletingAllRowsFromTable, preventAccidentalDroppingOfDatabases, preventAccidentalDroppingOfTables, preventDroppingOfDatabases, preventDroppingOfTables, printSQLIfRequested, printSQLIfRequested, removeForeignKeyConstraints, removeRegularProcess, requiredToProduceEmptyStringForNull, rollbackTransaction, save, save, save, setBatchSQLStatementsWhenPossible, setDatabaseName, setDefinition, setDefinitionBasedOnConnectionMetaData, setDriverName, setHasCreatedRequiredTables, setJdbcURL, setLabel, setLastException, setPassword, setPreventAccidentalDeletingAllRowsFromTable, setPrintSQLBeforeExecuting, setQuietExceptionsPreference, setSettings, setUsername, startServerIfRequired, stop, supportsDifferenceBetweenNullAndEmptyString, supportsGeometryTypesFullyInSchema, supportsMicrosecondPrecision, supportsNanosecondPrecision, supportsPolygonDatatype, supportsPooledConnections, tableExists, tableExists, toString, unusedConnection, update, update, updateTableToMatchDBRow, willCreateBlankQuery
-
-
-
-
Field Detail
-
serialVersionUID
public static final long serialVersionUID
- See Also:
- Constant Field Values
-
DRIVER_NAME
public static final String DRIVER_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JavaDBMemoryDB
public JavaDBMemoryDB(DataSource dataSource) throws SQLException
Creates a new JavaDB instance that will connect to the DataSource.- Parameters:
dataSource
- dataSource- Throws:
SQLException
- database errors
-
JavaDBMemoryDB
public JavaDBMemoryDB(JavaDBMemorySettingsBuilder settings) throws SQLException
Creates a new JavaDB instance that will connect to the DataSource.- Parameters:
settings
- dataSource- Throws:
SQLException
- database errors
-
JavaDBMemoryDB
public JavaDBMemoryDB(String jdbcURL, String username, String password) throws SQLException
Creates a new JavaDB instance that will connect to the JDBC URL using the username and password supplied..- Parameters:
jdbcURL
- jdbcURLusername
- usernamepassword
- password- Throws:
SQLException
- database errors
-
JavaDBMemoryDB
public JavaDBMemoryDB(String host, int port, String database, String username, String password) throws SQLException, UnableToCreateDatabaseConnectionException, UnableToFindJDBCDriver
Creates or connects to a JavaDB in-memory instance.- Parameters:
host
- hostusername
- usernameport
- portdatabase
- databasepassword
- password- Throws:
SQLException
- java.sql.SQLExceptionUnableToCreateDatabaseConnectionException
UnableToFindJDBCDriver
-
-
Method Detail
-
clone
public JavaDBMemoryDB clone() throws CloneNotSupportedException
Description copied from class:DBDatabaseImplementation
Clones the DBDatabase.- Specified by:
clone
in interfaceDBDatabase
- Overrides:
clone
in classDBDatabaseImplementation
- Returns:
- a clone of the DBDatabase.
- Throws:
CloneNotSupportedException
- not likely
-
addDatabaseSpecificFeatures
public void addDatabaseSpecificFeatures(Statement statement) throws ExceptionDuringDatabaseFeatureSetup
Description copied from interface:DBDatabase
Used By Subclasses To Inject Datatypes, Functions, Etc Into the Database.- Parameters:
statement
- the statement to use when adding features, DO NOT CLOSE THIS STATEMENT.- Throws:
ExceptionDuringDatabaseFeatureSetup
- database exceptions may occur- See Also:
PostgresDB
,H2DB
,SQLiteDB
,OracleDB
,MSSQLServerDB
,MySQLDB
-
isMemoryDatabase
public boolean isMemoryDatabase()
- Specified by:
isMemoryDatabase
in interfaceDBDatabase
- Overrides:
isMemoryDatabase
in classDBDatabaseImplementation
-
getDefaultPort
public Integer getDefaultPort()
Description copied from class:DBDatabaseImplementation
Returns the port number usually assign to instances of this database.There is no guarantee that the particular database instance uses this port, check with your DBA.
- Specified by:
getDefaultPort
in interfaceDBDatabase
- Specified by:
getDefaultPort
in classDBDatabaseImplementation
- Returns:
- the usual database port number
-
getURLInterpreter
public JavaDBMemorySettingsBuilder getURLInterpreter()
-
-