Class JDBCDatabaseInterface

java.lang.Object
com.mckoi.database.jdbcserver.AbstractJDBCDatabaseInterface
com.mckoi.database.jdbcserver.JDBCDatabaseInterface
All Implemented Interfaces:
DatabaseInterface

public class JDBCDatabaseInterface extends AbstractJDBCDatabaseInterface
An implementation of jdbc.DatabaseInterface on the server-side.

This receives database commands and dispatches them to the database system. This assumes that all calls to the methods here are in a UserWorkerThread thread.

NOTE: Currently, the client/server use of this object isn't multi-threaded, however the local connection could be. Therefore, this object has been made multi-thread safe.

Author:
Tobias Downer
  • Constructor Details

    • JDBCDatabaseInterface

      public JDBCDatabaseInterface(Database database, String host_name)
      Sets up the processor.
  • Method Details

    • login

      public boolean login(String default_schema, String username, String password, DatabaseCallBack database_call_back) throws SQLException
      Description copied from interface: DatabaseInterface
      Attempts to log in to the database as the given username with the given password. Only one user may be authenticated per connection. This must be called before the other methods are used.

      A DatabaseCallBack implementation must be given here that is notified of all events from the database. Events are only received if the login was successful.

      Throws:
      SQLException
    • execQuery

      public QueryResponse execQuery(SQLQuery query) throws SQLException
      Description copied from interface: DatabaseInterface
      Executes the query and returns a QueryResponse object that describes the result of the query. The QueryResponse object describes the number of rows, describes the columns, etc. This method will block until the query has completed. The QueryResponse can be used to obtain the 'result id' variable that is used in subsequent queries to the engine to retrieve the actual result of the query.
      Specified by:
      execQuery in interface DatabaseInterface
      Overrides:
      execQuery in class AbstractJDBCDatabaseInterface
      Throws:
      SQLException
    • dispose

      public void dispose() throws SQLException
      Description copied from interface: DatabaseInterface
      Called when the connection is disposed. This will terminate the connection if there is any connection to terminate.
      Throws:
      SQLException