org.geotools.data.hsql
Class HsqlConnectionFactory

java.lang.Object
  extended byorg.geotools.data.hsql.HsqlConnectionFactory

public class HsqlConnectionFactory
extends java.lang.Object

This creates connections for the HSQL datasource to make its transactions. To create a HsqlDataStore, create a HsqlConnectionFactory, and pass that connection factory to the HsqlDataStore constructor.

Author:
Amr Alam, Refractions Research

Constructor Summary
HsqlConnectionFactory(java.lang.String dbFileName, java.lang.String user, java.lang.String password)
          Creates a new HsqlConnectionFactory object from a DB filename, a username and a password.
 
Method Summary
 java.sql.Connection getConnection()
           
 java.sql.Connection getConnection(java.lang.String dbFileName)
           
 java.sql.Connection getConnection(java.lang.String dbFileName, java.util.Properties props)
          Creates a database connection method to initialize a given database for feature extraction with the given Properties.
 java.sql.Connection getConnection(java.lang.String username, java.lang.String password)
          Creates and returns a HSQL Connection based upon the username and password parameters passed to this method.
 java.sql.Connection getConnection(java.lang.String dbFileName, java.lang.String user, java.lang.String password)
          Creates and returns a HSQL Connection based upon the username and password parameters passed to this method.
 void setCharSet(java.lang.String charSet)
          Sets a different character set for the hsql driver to use.
 void setDBFileName(java.lang.String dbFileName)
          Sets the HSQL database filename.
 void setLogin(java.lang.String username, java.lang.String password)
          Sets the HSQL database login credentials.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HsqlConnectionFactory

public HsqlConnectionFactory(java.lang.String dbFileName,
                             java.lang.String user,
                             java.lang.String password)
Creates a new HsqlConnectionFactory object from a DB filename, a username and a password.

Parameters:
dbFileName - the HSQL database filename
user - the HSQL database username
password - the HSQL database password for user
Method Detail

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns:
an HSQL Connection object
Throws:
java.sql.SQLException - if an error occurs connecting to the HSQL database

getConnection

public java.sql.Connection getConnection(java.lang.String dbFileName)
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection(java.lang.String username,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Creates and returns a HSQL Connection based upon the username and password parameters passed to this method. This is shorthand for the following two calls:

connPool.setLogin(username, password);
connPool.setDBFileName(filename);
connPool.getConnection();

Parameters:
username - the HSQL username
password - the password corresponding to username
Returns:
an HSQL Connection object
Throws:
java.sql.SQLException - if an error occurs connecting to the HSQL database

getConnection

public java.sql.Connection getConnection(java.lang.String dbFileName,
                                         java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Creates and returns a HSQL Connection based upon the username and password parameters passed to this method. This is shorthand for the following two calls:

connPool.setLogin(username, password);
connPool.setDBFileName(filename);
connPool.getConnection();

Parameters:
dbFileName - the filename to use for the new database connection.
user - the name of the user connect to connect to the pgsql db.
password - the password for the user.
Returns:
the sql Connection object to the database.
Throws:
java.sql.SQLException - if the postgis sql driver could not be found

getConnection

public java.sql.Connection getConnection(java.lang.String dbFileName,
                                         java.util.Properties props)
                                  throws java.sql.SQLException
Creates a database connection method to initialize a given database for feature extraction with the given Properties.

Parameters:
dbFileName - the filename to use for the new database connection.
props - Should contain at a minimum the user and password. Additional properties, such as charSet, can also be added.
Returns:
the sql Connection object to the database.
Throws:
java.sql.SQLException - if the postgis sql driver could not be found

setLogin

public void setLogin(java.lang.String username,
                     java.lang.String password)
Sets the HSQL database login credentials.

Parameters:
username - the username
password - the password

setDBFileName

public void setDBFileName(java.lang.String dbFileName)
Sets the HSQL database filename.

Parameters:
dbFileName - the filename to use for this database

setCharSet

public void setCharSet(java.lang.String charSet)
Sets a different character set for the hsql driver to use.

Parameters:
charSet - the string of a valid charset name.


Copyright © GeoTools. All Rights Reserved.