Package org.h2gis.functions.factory

## Class H2GISDBFactory

- java.lang.Object
- - org.h2gis.functions.factory.H2GISDBFactory

    public class H2GISDBFactory
    extends Object

Used to create quickly a database.

Author:
  Nicolas Fortin, Erwan Bocher, Sylvain Palominos

### Field Summary

Fields
`static String` `DEFAULT_PASSWORD`
`static String` `DEFAULT_USER`
`static String` `H2_PARAMETERS`
`static String` `JDBC_DATABASE_NAME`
`static String` `JDBC_NETWORK_PROTOCOL`
`static String` `JDBC_PASSWORD`
`static String` `JDBC_PORT_NUMBER`
`static String` `JDBC_SERVER_NAME`
`static String` `JDBC_URL`
`static String` `JDBC_USER`
`static String` `START_URL`

### Method Summary

All Methods Static Methods Concrete Methods
`static DataSource` `createDataSource​(String dbName, boolean initSpatial)` Create a database and return a DataSource
`static DataSource` `createDataSource​(String dbName, boolean initSpatial, String h2Parameters)` Create a database and return a DataSource
`static DataSource` `createDataSource​(Properties properties)` Create a database, init spatial funcyion and return a DataSource
`static DataSource` `createDataSource​(Properties properties, boolean initSpatial)` Create a database and return a DataSource
`static Connection` `createSpatialDataBase​(String dbName)` Create a spatial database
`static Connection` `createSpatialDataBase​(String dbName, boolean initSpatial)` Create a spatial database and register all H2GIS functions
`static Connection` `createSpatialDataBase​(String dbName, boolean initSpatial, String h2Parameters)` Create a spatial database
`static Connection` `openSpatialDataBase​(String dbName)` Open the connection to an existing database

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### H2_PARAMETERS

    public static final String H2_PARAMETERS

See Also:
  Constant Field Values

#### JDBC_URL

    public static final String JDBC_URL

See Also:
  Constant Field Values

#### JDBC_USER

    public static final String JDBC_USER

See Also:
  Constant Field Values

#### JDBC_PASSWORD

    public static final String JDBC_PASSWORD

See Also:
  Constant Field Values

#### START_URL

    public static final String START_URL

See Also:
  Constant Field Values

#### JDBC_DATABASE_NAME

    public static final String JDBC_DATABASE_NAME

See Also:
  Constant Field Values

#### JDBC_NETWORK_PROTOCOL

    public static final String JDBC_NETWORK_PROTOCOL

See Also:
  Constant Field Values

#### JDBC_PORT_NUMBER

    public static final String JDBC_PORT_NUMBER

See Also:
  Constant Field Values

#### JDBC_SERVER_NAME

    public static final String JDBC_SERVER_NAME

See Also:
  Constant Field Values

#### DEFAULT_USER

    public static final String DEFAULT_USER

See Also:
  Constant Field Values

#### DEFAULT_PASSWORD

    public static final String DEFAULT_PASSWORD

See Also:
  Constant Field Values

### Method Detail

#### openSpatialDataBase

    public static Connection openSpatialDataBase​(String dbName)
                                          throws SQLException

Open the connection to an existing database

Parameters:
  `dbName` -
Returns:
Throws:
  `SQLException`

#### createSpatialDataBase

    public static Connection createSpatialDataBase​(String dbName)
                                            throws SQLException,
                                                   ClassNotFoundException

Create a spatial database

Parameters:
  `dbName` - filename
Returns:
  Connection
Throws:
  `SQLException`
  `ClassNotFoundException`

#### 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`

#### 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`

#### 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`

#### createDataSource

    public static DataSource createDataSource​(String dbName,
                                              boolean initSpatial,
                                              String h2Parameters)
                                       throws SQLException

Create a database and return a DataSource

Parameters:
  `dbName` -
  `initSpatial` -
  `h2Parameters` -
Returns:
Throws:
  `SQLException`

#### createSpatialDataBase

    public static Connection createSpatialDataBase​(String dbName,
                                                   boolean initSpatial,
                                                   String h2Parameters)
                                            throws SQLException,
                                                   ClassNotFoundException

Create a spatial database

Parameters:
  `dbName` - filename
  `initSpatial` - If true add spatial features to the database
  `h2Parameters` - Additional h2 parameters
Returns:
  Connection
Throws:
  `SQLException`
  `ClassNotFoundException`

#### createSpatialDataBase

    public static Connection createSpatialDataBase​(String dbName,
                                                   boolean initSpatial)
                                            throws SQLException,
                                                   ClassNotFoundException

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`
  `ClassNotFoundException`