Class DBHelper

  • Direct Known Subclasses:
    HypersonicDBHelper, MySQLDBHelper, OracleDBHelper, PostgreSQLDBHelper, UnknownDBHelper

    public abstract class DBHelper
    extends java.lang.Object
    Deprecated.
    Use hibernate and org.biojavax.bio.db.*
    Isolates all code that is specific to a particular RDBMS. To add support for a new RDBMS, write a new DBHelper subclass and ensure that it can be found by editing the getDBHelperForURL method in this class.
    Author:
    Thomas Down, Matthew Pocock, Len Trigg, Eric Haugen, Richard Holland
    • Constructor Detail

      • DBHelper

        public DBHelper()
        Deprecated.
    • Method Detail

      • getDBHelper

        public static DBHelper getDBHelper​(java.sql.Connection conn)
        Deprecated.
        Returns a DBHelper implementation suitable for a particular database.
        Parameters:
        conn - a connection to the database.
        Returns:
        a DBHelper.
      • getInsertID

        public abstract int getInsertID​(java.sql.Connection conn,
                                        java.lang.String table,
                                        java.lang.String columnName)
                                 throws java.sql.SQLException
        Deprecated.
        Returns the id value created during the last insert command. This is for tables that have an auto increment column.
        Returns:
        the last id assigned, or -1 if the id could not be found.
        Throws:
        java.sql.SQLException
      • getDeleteStyle

        public DBHelper.DeleteStyle getDeleteStyle()
        Deprecated.
        Returns the an object indicating the style of deletion that this database should employ. Unless overridden, this is DELETE_GENERIC.
        Returns:
        the preferred deletion style.
      • getJoinStyle

        public DBHelper.JoinStyle getJoinStyle()
        Deprecated.
        Returns the an object indicating the style of table joining that this database should employ.
        Returns:
        the preferred joining style.
      • getBioSequenceStyle

        public DBHelper.BioSequenceStyle getBioSequenceStyle()
        Deprecated.
        Returns the an object indicating the style of biosequence storage that this database should employ. Generally, leave it at the default unless you are using the Oracle schema, in which case you need to override it to return BIOSEQUENCE_ORACLECLOB. This is because, in the Oracle schema we need to use CLOBs (except when using Len Trigg's version which uses LONGs instead.)
        Returns:
        the preferred joining style.
      • containsTable

        public boolean containsTable​(javax.sql.DataSource ds,
                                     java.lang.String tablename)
        Deprecated.
        Detects whether a particular table is present in the database.
        Parameters:
        ds - a DataSource that can provide a connection to a database
        tablename - the name of the table.
        Returns:
        true if the table exists in the database.
        Throws:
        java.lang.NullPointerException - if pool is null.
        java.lang.IllegalArgumentException - if tablename is null or empty.