com.googlecode.jdbw
Interface DatabaseServer

All Known Subinterfaces:
H2Server, MultiCatalogDatabaseServer, NetworkDatabaseServer, UserAuthenticatedDatabaseServer
All Known Implementing Classes:
AbstractDatabaseServer, H2FileBasedServer, H2InMemoryServer, H2NetworkServer, MySQLServer, PostgresqlServer, StandardDatabaseServer, SybaseASEServer

public interface DatabaseServer

This interface represents a database server and exposes methods for inspecting the servers characteristics and establishing a DatabaseConnection to it.

Author:
Martin Berglund

Method Summary
 DatabaseConnection connect(DataSourceFactory dataSourceFactory)
          Created a new DataSource to this server and returns it wrapped in a DatabaseConnection
 DatabaseServerType getServerType()
           
 void setConnectionProperty(String key, String value)
          Sets a property to be passed in when creating a database connection.
 void testConnection()
          Tries to create a new database connection and immediately close it.
 

Method Detail

getServerType

DatabaseServerType getServerType()
Returns:
Type of the server

setConnectionProperty

void setConnectionProperty(String key,
                           String value)
Sets a property to be passed in when creating a database connection. These user-set properties are added to the connection properties list at the end, overriding any properties that may already have been created by the DatabaseServer implementation.

Parameters:
key - Name of the JDBC connection property
value - Value for the JDBC connection property

connect

DatabaseConnection connect(DataSourceFactory dataSourceFactory)
Created a new DataSource to this server and returns it wrapped in a DatabaseConnection

Parameters:
dataSourceFactory - Factory to use when creating the DataSource
Returns:
DatabaseConnection connected to the server

testConnection

void testConnection()
                    throws SQLException
Tries to create a new database connection and immediately close it. If there is any connection errors when trying to create the connection, the method will throw the corresponding SQLException that was thrown by the JDBC driver.

Throws:
SQLException - In case there was an error connecting to the database server


Copyright © 2012. All Rights Reserved.