quarks.samples.connectors.jdbc

Class DbUtils

  • java.lang.Object
    • quarks.samples.connectors.jdbc.DbUtils


  • public class DbUtils
    extends java.lang.Object
    Utilities for the sample's non-streaming JDBC database related actions.
    • Constructor Summary

      Constructors 
      Constructor and Description
      DbUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static javax.sql.DataSource getDataSource(java.util.Properties props)
      Get the JDBC DataSource for the database.
      static void initDb(javax.sql.DataSource ds)
      Initialize the sample's database.
      static void purgeTables(javax.sql.DataSource ds)
      Purge the sample's tables
      • Methods inherited from class java.lang.Object

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

      • DbUtils

        public DbUtils()
    • Method Detail

      • getDataSource

        public static javax.sql.DataSource getDataSource(java.util.Properties props)
                                                  throws java.lang.Exception
        Get the JDBC DataSource for the database.

        The "db.name" property specifies the name of the database. Defaults to "JdbcConnectorSampleDb".

        Parameters:
        props - configuration properties
        Returns:
        the DataSource
        Throws:
        java.lang.Exception
      • initDb

        public static void initDb(javax.sql.DataSource ds)
                           throws java.lang.Exception
        Initialize the sample's database.

        Tables are created as needed and purged.

        Parameters:
        ds - the DataSource
        Throws:
        java.lang.Exception
      • purgeTables

        public static void purgeTables(javax.sql.DataSource ds)
                                throws java.lang.Exception
        Purge the sample's tables
        Parameters:
        ds - the DataSource
        Throws:
        java.lang.Exception

Copyright IBM 2015,2016 - 2f6ad0e-20160307-0902