Closeable, AutoCloseableJDBCEmbeddedConnectionpublic class MonetDBEmbeddedConnection extends Object implements Closeable
| Modifier and Type | Field | Description |
|---|---|---|
protected long |
connectionPointer |
The C connection pointer.
|
| Modifier | Constructor | Description |
|---|---|---|
protected |
MonetDBEmbeddedConnection(long connectionPointer) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
checkIfTableExists(String schemaName,
String tableName) |
Check if a table exists in the database.
|
void |
close() |
Shuts down this connection.
|
protected void |
closeConnectionImplementation() |
When the database shuts down, this method is called instead
|
void |
commit() |
Commits the current transaction.
|
QueryResultSet |
executeQuery(String query) |
Executes a SQL query with a result set.
|
int |
executeUpdate(String query) |
Executes a SQL query without a result set, returning the number of rows it affected.
|
protected void |
finalize() |
Overriding the finalize method to close the connection
|
boolean |
getAutoCommit() |
Retrieves the current auto-commit mode for this connection.
|
MonetDBTable |
getMonetDBTable(String tableName) |
Retrieves a MonetDB Table in the current schema for further operations.
|
MonetDBTable |
getMonetDBTable(String schemaName,
String tableName) |
Retrieves a database table for further operations on it such as appending data.
|
long |
getRandomIdentifier() |
Retrieves a long number randomly generated, used to identify the connection uniquely.
|
String |
getSchema() |
Retrieves the current schema set on the connection.
|
boolean |
isClosed() |
Tells if the connection has been closed or not.
|
QueryResultSet |
listTables(boolean listSystemTables) |
Performs a listing of the existing tables with schemas.
|
MonetDBEmbeddedPreparedStatement |
prepareStatement(String query) |
Starts a prepared statement.
|
void |
releaseSavepoint(Savepoint savepoint) |
Removes the given Savepoint object from the current transaction.
|
void |
removeTable(String schemaName,
String tableName) |
Deletes a table if exists in the database.
|
void |
rollback() |
Rollbacks the current transaction.
|
void |
rollback(Savepoint savepoint) |
Undoes all changes made after the given Savepoint object was set.
|
void |
setAutoCommit(boolean autoCommit) |
Sets this connection's auto-commit mode to the given state.
|
Savepoint |
setSavepoint() |
Creates an unnamed savepoint in the current transaction and returns the new Savepoint object that represents it.
|
Savepoint |
setSavepoint(String name) |
Creates a savepoint with the given name in the current transaction and returns the new Savepoint object that
represents it.
|
void |
setSchema(String newSchema) |
Sets the current schema for this connection.
|
void |
startTransaction() |
Begins a transaction.
|
String |
toString() |
A brief description of the connection.
|
protected MonetDBEmbeddedConnection(long connectionPointer)
public long getRandomIdentifier()
public boolean isClosed()
public String getSchema() throws MonetDBEmbeddedException
MonetDBEmbeddedException - If an error in the database occurredpublic void setSchema(String newSchema) throws MonetDBEmbeddedException
newSchema - Java String with the name of the schemaMonetDBEmbeddedException - If an error in the database occurredpublic boolean getAutoCommit()
throws MonetDBEmbeddedException
MonetDBEmbeddedException - if a database access error occurspublic void setAutoCommit(boolean autoCommit)
throws MonetDBEmbeddedException
autoCommit - true to enable auto-commit mode; false to disable itMonetDBEmbeddedException - if a database access error occurspublic void startTransaction()
throws MonetDBEmbeddedException
MonetDBEmbeddedException - If an error in the database occurredpublic void commit()
throws MonetDBEmbeddedException
MonetDBEmbeddedException - If an error in the database occurredpublic void rollback()
throws MonetDBEmbeddedException
MonetDBEmbeddedException - If an error in the database occurredpublic Savepoint setSavepoint() throws MonetDBEmbeddedException
MonetDBEmbeddedException - if a database access error occurs or this Connection object is currently in
auto-commit modepublic Savepoint setSavepoint(String name) throws MonetDBEmbeddedException
name - a String containing the name of the savepointMonetDBEmbeddedException - if a database access error occurs or this connection object is currently in
auto-commit modepublic void releaseSavepoint(Savepoint savepoint) throws MonetDBEmbeddedException
savepoint - the Savepoint object to be removedMonetDBEmbeddedException - if a database access error occurs or the given Savepoint object is not a valid
savepoint in the current transactionpublic void rollback(Savepoint savepoint) throws MonetDBEmbeddedException
savepoint - the Savepoint object to roll back toMonetDBEmbeddedException - if a database access error occurs, the Savepoint object is no longer valid, or
this Connection object is currently in auto-commit modepublic int executeUpdate(String query) throws MonetDBEmbeddedException
query - The SQL query stringMonetDBEmbeddedException - If an error in the database occurredpublic QueryResultSet executeQuery(String query) throws MonetDBEmbeddedException
query - The SQL query stringMonetDBEmbeddedException - If an error in the database occurredpublic MonetDBEmbeddedPreparedStatement prepareStatement(String query) throws MonetDBEmbeddedException
query - The SQL query stringMonetDBEmbeddedException - If an error in the database occurredpublic MonetDBTable getMonetDBTable(String schemaName, String tableName) throws MonetDBEmbeddedException
schemaName - The schema of the tabletableName - The name of the tableMonetDBEmbeddedException - If an error in the database occurredpublic MonetDBTable getMonetDBTable(String tableName) throws MonetDBEmbeddedException
tableName - The name of the tableMonetDBEmbeddedException - If an error in the database occurredpublic QueryResultSet listTables(boolean listSystemTables) throws MonetDBEmbeddedException
listSystemTables - List system's tables as well (default true)null if the database is not runningMonetDBEmbeddedException - If an error in the database occurredpublic boolean checkIfTableExists(String schemaName, String tableName) throws MonetDBEmbeddedException
schemaName - The schema of the tabletableName - The name of the tableMonetDBEmbeddedException - If an error in the database occurredpublic void removeTable(String schemaName, String tableName) throws MonetDBEmbeddedException
schemaName - The schema of the tabletableName - The name of the tableMonetDBEmbeddedException - If an error in the database occurredprotected void closeConnectionImplementation()
public String toString()
public void close()
close in interface AutoCloseableclose in interface CloseableCopyright © 2018. All rights reserved.