Class RDBConnectionHandler

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class RDBConnectionHandler
    extends java.lang.Object
    implements java.io.Closeable
    Utility functions for connection handling.
    • Constructor Summary

      Constructors 
      Constructor Description
      RDBConnectionHandler​(@NotNull javax.sql.DataSource ds)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void closeConnection​(java.sql.Connection c)
      Close the Connection.
      @NotNull java.sql.Connection getROConnection()
      Obtain a Connection suitable for read-only operations.
      @NotNull java.sql.Connection getRWConnection()
      Obtain a Connection suitable for read-write operations.
      @Nullable java.lang.String getSchema​(java.sql.Connection c)
      Return current schema name or null when unavailable
      boolean isClosed()  
      void rollbackConnection​(@Nullable java.sql.Connection c)
      Roll back the Connection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RDBConnectionHandler

        public RDBConnectionHandler​(@NotNull
                                    @NotNull javax.sql.DataSource ds)
    • Method Detail

      • getROConnection

        @NotNull
        public @NotNull java.sql.Connection getROConnection()
                                                     throws java.sql.SQLException
        Obtain a Connection suitable for read-only operations.
        Throws:
        java.sql.SQLException
      • getRWConnection

        @NotNull
        public @NotNull java.sql.Connection getRWConnection()
                                                     throws java.sql.SQLException
        Obtain a Connection suitable for read-write operations.
        Throws:
        java.sql.SQLException
      • rollbackConnection

        public void rollbackConnection​(@Nullable
                                       @Nullable java.sql.Connection c)
        Roll back the Connection.
      • closeConnection

        public void closeConnection​(java.sql.Connection c)
        Close the Connection.
      • getSchema

        @Nullable
        public @Nullable java.lang.String getSchema​(java.sql.Connection c)
        Return current schema name or null when unavailable
      • isClosed

        public boolean isClosed()
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException