Class DBSystem

java.lang.Object
generalDatabase.DBSystem
Direct Known Subclasses:
BaseAccessSystem, ServerBasedSystem, SqliteSystem, SQLServerSystem

public abstract class DBSystem extends Object
  • Constructor Details

    • DBSystem

      public DBSystem()
  • Method Details

    • getSystemName

      public abstract String getSystemName()
      Returns:
      The name of the database system
    • canCreate

      public abstract boolean canCreate()
      Returns:
      true if the system can create new databases.
    • getDatabaseName

      public abstract String getDatabaseName()
      Returns:
      the name of the currently open database.
    • getShortDatabaseName

      public String getShortDatabaseName()
      Get a shorter version of the currently open database name (e.g. without the file path name)
      Returns:
      a shorter name
    • getSqlTypes

      public abstract SQLTypes getSqlTypes()
      Get the SQLTypes object which can be used to preform system specific formatting of SQL strings.
      Returns:
    • exists

      public abstract boolean exists()
      Returns:
      true if the database exists
    • create

      public abstract boolean create()
      Create a new database

      The underlying DBSystem will be responsible for any dialogs to chose database names, etc.

      Returns:
      true if successful.
    • getConnection

      public final PamConnection getConnection()
      Open a new database connection with the default name.
    • getConnection

      public abstract PamConnection getConnection(String databaseName)
      Open new database connection with a specific name
      Parameters:
      databaseName -
      Returns:
    • closeConnection

      public void closeConnection(PamConnection connection)
      Close the database connection
      Parameters:
      connection -
    • browseDatabases

      public abstract String browseDatabases(Component parent)
    • getDialogPanel

      public abstract SystemDialogPanel getDialogPanel(Component parent)
      Get a database specific dialog panel to include in the database select dialog.
      Parameters:
      parent - parent component
      Returns:
      dialog panel
    • createPamCursor

      public abstract PamCursor createPamCursor(EmptyTableDefinition tableDefinition)
    • hasDriver

      public abstract boolean hasDriver()
      Returns:
      true if the driver for this database system is available on this computer. the availability of database system will depend both on the OS and whether software are installed.
    • getKeywords

      public String getKeywords()
      Get a list of keywords which potentially may not be used for column names in an SQL statement. In reality, this list is complete overkill. Override for each system and try to reduce the list as much as possible.
      Returns:
      list of restricted keywords.
    • canOpenDatabase

      public boolean canOpenDatabase()
      find out if it's possible to open the current databse with a host application (e.g. MS Access).
      Returns:
      true if it's possible.
    • openCurrentDatabase

      public boolean openCurrentDatabase()
      Open the database with it's host application if available (e.g. open MS access database with Access).
      Returns:
      true if opened sucessfully.
    • getDialogPaneFX

      public abstract SystemDialogPaneFX getDialogPaneFX()
      Get the FX pane for the database system
      Returns:
      the FX settings pane for the database system.
    • browseDatabasesFX

      public abstract String browseDatabasesFX(int type)
      Browse for databases using an FX dialog.
      Parameters:
      type -
      Returns:
    • checkDatabaseExists

      public boolean checkDatabaseExists(String dbName)
    • checkDatabaseExists

      public boolean checkDatabaseExists()
      Check a database file exists on the system. Default code here is not suitable for server based database systems.
      Returns:
      false if a file name is there, but no file.