com.googlecode.jdbw
Interface DatabaseConnection

All Known Implementing Classes:
DatabaseConnectionImpl

public interface DatabaseConnection

This interface represents a connection to a database server, although in reality this is probably more than one connection (probably a pool of them). The main methods used to interact with the database server are:

Author:
Martin Berglund

Method Summary
 DatabaseTransaction beginTransaction(TransactionIsolation isolation)
          Allocated a connection and begins a transaction
 void close()
          Closes this connection and any underlying data source
 AutoExecutor createAutoExecutor()
          Creates an AutoExecutor using this database connection for supplying connections
 Catalog getCatalog(String catalogName)
          Looks up one catalog on the server
 List<Catalog> getCatalogs()
           
 String getDefaultCatalogName()
           
 TransactionIsolation getDefaultTransactionIsolation()
           
 DatabaseServerType getServerType()
           
 

Method Detail

getServerType

DatabaseServerType getServerType()
Returns:
Type of the server this connection is connected to

beginTransaction

DatabaseTransaction beginTransaction(TransactionIsolation isolation)
                                     throws SQLException
Allocated a connection and begins a transaction

Parameters:
isolation - Isolation level for the new transaction
Returns:
DatabaseTransaction object representing the new transaction
Throws:
SQLException - If an error occurred when allocating a connection for this transaction

createAutoExecutor

AutoExecutor createAutoExecutor()
Creates an AutoExecutor using this database connection for supplying connections

Returns:
AutoExecutor using this connection

getDefaultCatalogName

String getDefaultCatalogName()
Returns:
Default catalog name of this connection

getDefaultTransactionIsolation

TransactionIsolation getDefaultTransactionIsolation()
Returns:
Default transaction isolation of this connection

getCatalogs

List<Catalog> getCatalogs()
                          throws SQLException
Returns:
List of all catalogs available on this server
Throws:
SQLException - If an error occurred when asking the database for catalog information

getCatalog

Catalog getCatalog(String catalogName)
                   throws SQLException
Looks up one catalog on the server

Parameters:
catalogName - Name of the catalog
Returns:
Catalog object representing the catalog or null if not found
Throws:
SQLException - If an error occurred when asking the database for catalog information

close

void close()
Closes this connection and any underlying data source



Copyright © 2012. All Rights Reserved.