org.hsqldb.jdbc
Class JDBCDataSourceFactory

java.lang.Object
  extended by org.hsqldb.jdbc.JDBCDataSourceFactory
All Implemented Interfaces:
ObjectFactory

public class JDBCDataSourceFactory
extends Object
implements ObjectFactory

A JNDI ObjectFactory for creating data sources supported by HyperSQL JDBCDataSource for plain connections for the end user. JDBCPool for pooled plain connections for the end user. JDBCPooledDataSource for PooleConnection objects used by external connection pooling software. JDBCXADataSource for XAConnection objects used by external connection pooling software.

Author:
Darin DeForest (deforest@users dot sourceforge.net) original version, Fred Toussi (fredt@users dot sourceforge.net)

Constructor Summary
JDBCDataSourceFactory()
           
 
Method Summary
static DataSource createDataSource(Properties props)
          Static method to create a JDBCDataSource instance using the given properties for url, user, password, etc.
 Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment)
          Creates a DataSource object using the javax.naming.Reference object specified.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JDBCDataSourceFactory

public JDBCDataSourceFactory()
Method Detail

createDataSource

public static DataSource createDataSource(Properties props)
                                   throws Exception
Static method to create a JDBCDataSource instance using the given properties for url, user, password, etc.

Throws:
Exception

getObjectInstance

public Object getObjectInstance(Object obj,
                                Name name,
                                Context nameCtx,
                                Hashtable environment)
                         throws Exception
Creates a DataSource object using the javax.naming.Reference object specified.

The Reference object's class name should be one of the four supported data source class names and it must support the properties, database, user and password. It may optionally support the logingTimeout property. HyperSQL's JDBCPooledDataSource and JDBCXADataSource object are intended as factories used by a connection pooling DataSource.

JDBCDataSource is a factory for normal connections and can be accessed directly by user applications.

JDBCPool is a connection pool accessed directly by user applications.

Specified by:
getObjectInstance in interface ObjectFactory
Parameters:
obj - The reference information used in creating a Datasource object.
name - ignored
nameCtx - ignored
environment - ignored
Returns:
A newly created JDBCDataSource object; null if an object cannot be created.
Throws:
Exception - is thrown if database or user is null or invalid


Copyright © 2001 - 2010 HSQL Development Group.