public class DataBase
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DataBase.Protection
Protection modes.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROPERTY_DRIVER
the raw driver class name
|
DataBase.Protection |
protection
Protection mode
|
static java.lang.String |
SQL_READ_TIMEOUT
SQL read timeout
|
static java.lang.String |
TYPE_DERBY
Derby database
|
static java.lang.String |
TYPE_HSQLDB
HSQLDB database
|
static java.lang.String |
TYPE_MSSQL
Microsoft SQL Server
|
static java.lang.String |
TYPE_MSSQL_NATIVE
Microsoft SQL Server using the Microsoft JDBC Driver
|
static java.lang.String |
TYPE_MYSQL
MySQL database
|
static java.lang.String |
TYPE_ORACLE
Oracle database.
|
static java.lang.String |
TYPE_POSTGRESQL
Postgres database
|
static java.lang.String |
TYPE_SYBASE
Sybase database
|
Constructor and Description |
---|
DataBase(java.lang.String userId,
java.lang.String password,
java.lang.String inType,
java.lang.String inUrl)
Deprecated.
specify the protection constructor.
|
DataBase(java.lang.String userId,
java.lang.String password,
java.lang.String inType,
java.lang.String inUrl,
DataBase.Protection protection)
create a new database
|
Modifier and Type | Method and Description |
---|---|
java.lang.StringBuilder |
appendSQLString(java.lang.StringBuilder buffer,
long l)
Returns the native expression of a long value for this database type.
|
void |
checkInConnection(java.sql.Connection connection) |
java.sql.Connection |
checkOutConnection()
Synchronized so that it puts a limit onto the number of connections
Hopefully if two threads require a connection by the time one has
connected another connection may be freed.
|
boolean |
checkVersion(int major,
int minor)
Version supported
|
void |
close()
close the database connections
|
void |
connect()
make a new connection.
|
java.lang.String |
displayDriverInfo()
Display the driver info ( class name and jar file).
|
java.lang.String |
encodeString(java.lang.String javaString)
SQL encoding for a string
|
static void |
exponentialBackOff(int attempt)
Sleep for a increasing amount of time as each attempt fails.
|
java.lang.String |
getBatchSeperator()
Returns which separator should be used for this database.
|
java.lang.String |
getCreateIndexSuffix()
get the create index suffix
|
java.lang.String |
getCreateTableSuffix()
get the create table suffix
|
static DataBase |
getCurrent() |
int |
getMajorVersion()
Retrieves the major version of the database
|
static java.lang.String |
getMasterDBName(java.lang.String inType) |
int |
getMaxPreparedStatements() |
int |
getMaxStatementLength()
The maximum statement length
|
int |
getMinorVersion()
Retrieves the minor version of the database
|
java.lang.String |
getPassword() |
java.lang.String |
getShortUrl() |
boolean |
getSupportsBatchInsertValues() |
boolean |
getSupportsBatchStatements()
Returns which separator should be used for this database.
|
boolean |
getSupportsIndexRenames()
does this database support renaming of indexes ?
|
boolean |
getSupportsTableRenames()
does this database support renaming of tables ?
|
java.lang.String |
getType() |
java.lang.String |
getTypeKey() |
java.lang.String |
getUrl() |
java.lang.String |
getUser() |
boolean |
hasSQLEscape()
The escape string.
|
boolean |
isCommentsSupported() |
boolean |
isConnected() |
boolean |
isShuttingDown()
Is the database shutting down ?
|
DataBase |
setCreateIndexSuffix(java.lang.String suffix)
set the create index suffix
|
DataBase |
setCreateTableSuffix(java.lang.String suffix)
set the create table suffix
|
DataBase |
setCurrent() |
DataBase |
setVisible(boolean visible) |
void |
shutDown() |
boolean |
supportsMultipleJVMs()
Some databases can not be shared by multiple JVM.
|
java.lang.String |
toString()
to string
|
public static final java.lang.String PROPERTY_DRIVER
public static final java.lang.String SQL_READ_TIMEOUT
public static final java.lang.String TYPE_DERBY
public static final java.lang.String TYPE_SYBASE
public static final java.lang.String TYPE_HSQLDB
public static final java.lang.String TYPE_POSTGRESQL
public static final java.lang.String TYPE_ORACLE
public static final java.lang.String TYPE_MYSQL
public static final java.lang.String TYPE_MSSQL
public static final java.lang.String TYPE_MSSQL_NATIVE
public final DataBase.Protection protection
public DataBase(java.lang.String userId, java.lang.String password, java.lang.String inType, java.lang.String inUrl) throws java.lang.Exception
userId
- the user idpassword
- the password to use when connecting.inType
- the database typeinUrl
- the connection URLjava.lang.Exception
- a serious problempublic DataBase(java.lang.String userId, java.lang.String password, @Nonnull java.lang.String inType, @Nonnull java.lang.String inUrl, @Nonnull DataBase.Protection protection) throws java.lang.Exception
userId
- the user idpassword
- the password to use when connecting.inType
- the database typeinUrl
- the connection URLprotection
- the protection mode.java.lang.Exception
- a serious problem@CheckReturnValue public int getMaxPreparedStatements()
@Nonnull public DataBase setCreateTableSuffix(@Nullable java.lang.String suffix)
suffix
- the suffix@CheckReturnValue @Nullable public java.lang.String getCreateTableSuffix()
@Nonnull public DataBase setCreateIndexSuffix(@Nullable java.lang.String suffix)
suffix
- the suffixpublic boolean isShuttingDown()
@CheckReturnValue @Nullable public java.lang.String getCreateIndexSuffix()
@CheckReturnValue public boolean checkVersion(int major, int minor)
major
- the major data base versionminor
- the minor data base version@CheckReturnValue @Nonnull public java.lang.String toString()
toString
in class java.lang.Object
public void close()
@Nonnull public java.lang.StringBuilder appendSQLString(@Nonnull java.lang.StringBuilder buffer, long l)
buffer
- the buffer of the SQL statementl
- the long value@CheckReturnValue public boolean isCommentsSupported()
@CheckReturnValue @Nonnull public java.lang.String getUrl()
@CheckReturnValue @Nonnull public java.lang.String getShortUrl()
@CheckReturnValue @Nonnull public java.lang.String getType()
@CheckReturnValue public boolean isConnected()
@CheckReturnValue public boolean supportsMultipleJVMs()
@CheckReturnValue @Nonnull public static java.lang.String getMasterDBName(@Nullable java.lang.String inType) throws java.lang.Exception
inType
- the database typejava.lang.Exception
- a serious problem@CheckReturnValue @Nonnull public java.lang.String getUser()
@CheckReturnValue @Nonnull public java.lang.String getPassword()
@Nonnull public DataBase setVisible(boolean visible)
visible
- true if visible@Nonnull public DataBase setCurrent()
@CheckReturnValue @Nonnull public java.lang.String getTypeKey()
@CheckReturnValue public int getMaxStatementLength()
public void connect() throws java.lang.Exception
java.lang.Exception
- a serious problempublic static void exponentialBackOff(int attempt)
attempt
- the attempt counter.@CheckReturnValue @Nonnull public java.lang.String displayDriverInfo()
@CheckReturnValue @Nonnull public java.lang.String getBatchSeperator()
@CheckReturnValue public boolean hasSQLEscape()
@CheckReturnValue @Nonnull public java.lang.String encodeString(@Nonnull java.lang.String javaString)
javaString
- the required encoding@CheckReturnValue @Nullable public static DataBase getCurrent()
@CheckReturnValue public boolean getSupportsBatchStatements()
@CheckReturnValue public boolean getSupportsBatchInsertValues()
@CheckReturnValue public boolean getSupportsTableRenames()
@CheckReturnValue public boolean getSupportsIndexRenames()
public void checkInConnection(@Nullable java.sql.Connection connection)
connection
- the connection to check in@CheckReturnValue @Nonnull public java.sql.Connection checkOutConnection() throws java.lang.Exception
java.lang.Exception
- a serious problem@CheckReturnValue public int getMajorVersion() throws java.lang.Exception
java.lang.Exception
- a serious problem@CheckReturnValue public int getMinorVersion() throws java.lang.Exception
java.lang.Exception
- a serious problempublic void shutDown()
stSoftware Copyright © 2001-2014 stSoftware All Rights Reserved.