JDBC Driver - PolyConnection

The PolyConnection class serves as the entry point for createing the required objects for executing queries and managing transactional contexts.

createStatement

Creates a Statement object for sending SQL statements to the database.

Signature:

Statement createStatement() throws SQLException

Returns:

Return Type Description
Statement An object that represents a precompiled SQL statement.

Throws:

Exception Description
SQLException If a database access error occurs or this method is called on a closed connection.

prepareStatement

Creates a PreparedStatement object for sending parameterized SQL statements to the database.

Signature:

PreparedStatement prepareStatement(String sql) throws SQLException

Parameters:

Parameter Name Type Description
sql String A SQL statement to be sent to the database.

Returns:

Return Type Description
PreparedStatement An object that represents a precompiled SQL statement.

Throws:

Exception Description
SQLException If a database access error occurs or this method is called on a closed connection.

prepareCall

Creates a CallableStatement object for calling database stored procedures.

Signature:

CallableStatement prepareCall(String sql) throws SQLException

Parameters:

Parameter Name Type Description
sql String A SQL statement to be sent to the database.

Returns:

Return Type Description
CallableStatement An object that represents a call to a stored procedure.

Throws:

Exception Description
SQLException If a database access error occurs or this method is called on a closed connection.

nativeSQL

Converts a given SQL statement into the system’s native SQL grammar.

Signature:

String nativeSQL(String sql) throws SQLException

Parameters:

Parameter Name Type Description
sql String A SQL statement with JDBC syntax.

Returns:

Return Type Description
String The native SQL query that the database would execute.

Throws:

Exception Description
SQLException If a database access error occurs or this method is called on a closed connection.

setAutoCommit

Sets this connection’s auto-commit mode to the given state.

Signature:

void setAutoCommit(boolean autoCommit) throws SQLException

Parameters:

Parameter Name Type Description
autoCommit boolean true to enable auto-commit mode; false to disable it.

Throws:

Exception Description
SQLException If a database access error occurs or this method is called on a closed connection.

getAutoCommit

Retrieves the current auto-commit mode for this Connection object.

Signature:

boolean getAutoCommit() throws SQLException

Returns:

Return Type Description
boolean The current state of this Connection object’s auto-commit mode.

Throws:

Exception Description
SQLException If a database access error occurs or this method is called on a closed connection.

commit

Makes all changes made since the previous commit/rollback permanent.

Signature:

void commit() throws SQLException

Throws:

Exception Description
SQLException If a database access error occurs, this method is called while participating in a distributed transaction, or this method is called on a closed connection.

rollback

Undoes all changes made in the current transaction.

Signature:

void rollback() throws SQLException

Throws:

Exception Description
SQLException If a database access error occurs, this method is called while participating in a distributed transaction, or this method is called on a closed connection.

close

Closes the database connection.

Signature:

void close() throws SQLException

Throws:

Exception Description
SQLException If a database access error occurs or the connection is already closed.

isClosed

Checks whether the connection is closed.

Signature:

boolean isClosed()

Returns:

Return Type Description
boolean true if the connection is closed; false otherwise.

getMetaData

Retrieves the database metadata.

Signature:

DatabaseMetaData getMetaData() throws SQLException

Returns:

Return Type Description
DatabaseMetaData An object that contains metadata about the database to which this Connection object is connected.

Throws:

Exception Description
SQLException If a database access error occurs or the connection is closed.

setReadOnly

Sets the connection to read-only mode.

Signature:

void setReadOnly(boolean readOnly) throws SQLException

Parameters:

Parameter Name Type Description
readOnly boolean true to set the connection to read-only mode; false to allow updates.

Throws:

Exception Description
SQLException If a database access error occurs or the connection is closed.

isReadOnly

Checks if the connection is in read-only mode.

Signature:

boolean isReadOnly() throws SQLException

Returns:

Return Type Description
boolean true if the connection is read-only; false otherwise.

Throws:

Exception Description
SQLException If a database access error occurs or the connection is closed.

setCatalog

Selects a specific database catalog.

Signature:

void setCatalog(String catalog) throws SQLException

Parameters:

Parameter Name Type Description
catalog String The name of the catalog to select for this connection.

Throws:

Exception Description
SQLException If a database access error occurs or the connection is closed.

getCatalog

Retrieves the current catalog name.

Signature:

String getCatalog()

Returns:

Return Type Description
String The name of the current catalog or null if no catalog is set.

setTransactionIsolation

Sets the transaction isolation level.

Signature:

void setTransactionIsolation(int level) throws SQLException

Parameters:

Parameter Name Type Description
level int One of the connection transaction isolation levels.

Throws:

Exception Description
SQLException If a database access error occurs, the connection is closed, or the given parameter is not one of the connection transaction isolation levels.

getTransactionIsolation

Retrieves the current transaction isolation level.

Signature:

int getTransactionIsolation() throws SQLException

Returns:

Return Type Description
int The current transaction isolation level.

Throws:

Exception Description
SQLException If a database access error occurs or the connection is closed.

getWarnings

Retrieves the first SQLWarning reported by calls on this Connection object.

Signature:

SQLWarning getWarnings() throws SQLException

Returns:

Return Type Description
SQLWarning The first SQLWarning object or null if there are no warnings.

Throws:

Exception Description
SQLException If a database access error occurs or the connection is closed.
© Polypheny GmbH. All Rights Reserved.