org.h2gis.h2spatial.ut
Class SpatialH2UT

java.lang.Object
  extended by org.h2gis.h2spatial.ut.SpatialH2UT

public class SpatialH2UT
extends Object

Used to create quickly a database on unit tests.

Author:
Nicolas Fortin

Field Summary
static String H2_PARAMETERS
           
 
Method Summary
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 Connection createSpatialDataBase(String dbName)
          Create a spatial database
static Connection createSpatialDataBase(String dbName, boolean initSpatial)
          Create a spatial database
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
Method Detail

openSpatialDataBase

public static Connection openSpatialDataBase(String dbName)
                                      throws SQLException,
                                             ClassNotFoundException
Open the connection to an existing database

Parameters:
dbName -
Returns:
Throws:
SQLException
ClassNotFoundException

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(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

Parameters:
dbName - filename
initSpatial - If true add spatial features to the database
Returns:
Connection
Throws:
SQLException
ClassNotFoundException


Copyright © 2015 IRSTV CNRS-FR-2488. All Rights Reserved.