Class JKOracleDataAccess

java.lang.Object
com.jk.data.dataaccess.core.JKDataAccessImpl
com.jk.data.vendors.oracle.JKOracleDataAccess
All Implemented Interfaces:
JKDataAccessService

public class JKOracleDataAccess extends JKDataAccessImpl
This class provides data access functionality specific to Oracle databases.

It extends the JKDataAccessImpl class.

Version:
1.0
Author:
Dr. Jalal H. Kiswani
  • Constructor Details

    • JKOracleDataAccess

      public JKOracleDataAccess(JKDataSource dataSource)
      This method constructs a new JKOracleDataAccess with the provided data source.
      Parameters:
      dataSource - Specifies the data source.
  • Method Details

    • blobToByteArray

      public static byte[] blobToByteArray(Blob blob) throws IOException, SQLException
      This method converts a Blob object to a byte array.
      Parameters:
      blob - Specifies the Blob object to convert.
      Returns:
      the byte array representation of the `Blob` data.
      Throws:
      IOException - if an I/O exception has occurred.
      SQLException - if a SQL error occurs while accessing the Blob.
    • getNextSequence

      public int getNextSequence(String squenceName)
      This method retrieves the next value from a specified sequence in the database.
      Parameters:
      squenceName - Specifies the name of the sequence from which to retrieve the next value.
      Returns:
      the next value from the specified sequence as an integer.
    • getSystemDate

      public Timestamp getSystemDate()
      This method retrieves the current system date and time from the database.
      Specified by:
      getSystemDate in interface JKDataAccessService
      Overrides:
      getSystemDate in class JKDataAccessImpl
      Returns:
      a Date object representing the current system date and time
    • isDuplicateKey

      protected boolean isDuplicateKey(SQLException e) throws SQLException
      This method checks if the provided SQLException indicates a duplicate key violation.
      Parameters:
      e - Specifies the exception to check.
      Returns:
      true, if the exception indicates a duplicate key violation, false otherwise.
      Throws:
      SQLException - if the exception is not a duplicate key violation.
    • isDuplicateKey

      protected boolean isDuplicateKey(SQLException e, boolean throwException) throws SQLException
      This method checks if the provided SQLException indicates a duplicate key violation.
      Parameters:
      e - Specifies the exception to check.
      throwException - Indicates whether to throw the exception if it's not a duplicate key violation (true) or not (false).
      Returns:
      true, if the exception indicates a duplicate key violation, false otherwise.
      Throws:
      SQLException - if the exception is not a duplicate key violation and throwException is true.
    • isTableExists

      public boolean isTableExists(String tableName)
      This method checks whether the table with the provided name exists in the database or not.
      Specified by:
      isTableExists in interface JKDataAccessService
      Overrides:
      isTableExists in class JKDataAccessImpl
      Parameters:
      tableName - Specifies the table name in the database.
      Returns:
      true, if the table exists, false otherwise.
    • describeTable

      public Map<String,String> describeTable(String name)
      This method retrieves data about a database table and returns it as a map of column names to their corresponding data types.
      Specified by:
      describeTable in interface JKDataAccessService
      Overrides:
      describeTable in class JKDataAccessImpl
      Parameters:
      name - Specifies the name of the table to describe.
      Returns:
      the map containing column names as keys and their corresponding data types as values.