Class H2GISDBFactory


  • public class H2GISDBFactory
    extends Object
    Used to create quickly a database.
    Author:
    Nicolas Fortin, Erwan Bocher, Sylvain Palominos
    • Method Detail

      • openSpatialDataBase

        public static Connection openSpatialDataBase​(String dbName)
                                              throws SQLException
        Open the connection to an existing database
        Parameters:
        dbName - Database name
        Returns:
        Active connection
        Throws:
        SQLException - Exception
      • createSpatialDataBase

        public static Connection createSpatialDataBase​(String dbName)
                                                throws SQLException
        Create a spatial database
        Parameters:
        dbName - filename
        Returns:
        Connection
        Throws:
        SQLException - SQL Exception
      • createDataSource

        public static DataSource createDataSource​(String dbName,
                                                  boolean initSpatial)
                                           throws SQLException
        Create a database and return a DataSource
        Parameters:
        dbName - DataBase name, or path URI
        initSpatial - True to enable basic spatial capabilities
        Returns:
        DataSource
        Throws:
        SQLException - SQL issue
      • createDataSource

        public static DataSource createDataSource​(Properties properties)
                                           throws SQLException
        Create a database, init spatial funcyion and return a DataSource
        Parameters:
        properties - for the opening of the DataBase.
        Returns:
        a DataSource
        Throws:
        SQLException - SQL issue
      • createDataSource

        public static DataSource createDataSource​(Properties properties,
                                                  boolean initSpatial)
                                           throws SQLException
        Create a database and return a DataSource
        Parameters:
        properties - for the opening of the DataBase.
        initSpatial - true to load the spatial functions
        Returns:
        a DataSource
        Throws:
        SQLException - SQL issue
      • createDataSource

        public static DataSource createDataSource​(String dbName,
                                                  boolean initSpatial,
                                                  String h2Parameters)
                                           throws SQLException
        Create a database and return a DataSource
        Parameters:
        dbName - Database name
        initSpatial - true to load the spatial functions
        h2Parameters - Additional h2 parameters
        Returns:
        DataSource instance
        Throws:
        SQLException - SQL issue
      • createSpatialDataBase

        public static Connection createSpatialDataBase​(String dbName,
                                                       boolean initSpatial,
                                                       String h2Parameters)
                                                throws SQLException
        Create a spatial database
        Parameters:
        dbName - filename
        initSpatial - If true add spatial features to the database
        h2Parameters - Additional h2 parameters
        Returns:
        Connection
        Throws:
        SQLException - SQL Exception
      • createSpatialDataBase

        public static Connection createSpatialDataBase​(String dbName,
                                                       boolean initSpatial)
                                                throws SQLException
        Create a spatial database and register all H2GIS functions
        Parameters:
        dbName - filename
        initSpatial - If true add spatial features to the database
        Returns:
        Connection
        Throws:
        SQLException - Database issue