- java.lang.Object
-
- org.hsqldb.jdbc.JDBCDataSourceFactory
-
- All Implemented Interfaces:
javax.naming.spi.ObjectFactory
public class JDBCDataSourceFactory extends java.lang.Object implements javax.naming.spi.ObjectFactoryA JNDI ObjectFactory for creating data sources supported by HyperSQLJDBCDataSourcefor plain connections for the end user.JDBCPoolfor pooled plain connections for the end user.JDBCPooledDataSourcefor PooleConnection objects used by external connection pooling software.JDBCXADataSourcefor 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
Constructors Constructor Description JDBCDataSourceFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static javax.sql.DataSourcecreateDataSource(java.util.Properties props)Static method to create a JDBCDataSource instance using the given properties for url, user, password, etc.java.lang.ObjectgetObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)Creates a DataSource object using the javax.naming.Reference object specified.
-
-
-
Method Detail
-
createDataSource
public static javax.sql.DataSource createDataSource(java.util.Properties props) throws java.lang.ExceptionStatic method to create a JDBCDataSource instance using the given properties for url, user, password, etc.- Parameters:
props- properties- Returns:
- the data source instance
- Throws:
java.lang.Exception- on any error
-
getObjectInstance
public java.lang.Object getObjectInstance(java.lang.Object obj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment) throws java.lang.ExceptionCreates 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 loginTimeout 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:
getObjectInstancein interfacejavax.naming.spi.ObjectFactory- Parameters:
obj- The reference information used in creating a Datasource object.name- ignorednameCtx- ignoredenvironment- ignored- Returns:
- A newly created JDBCDataSource object; null if an object cannot be created.
- Throws:
java.lang.Exception- is thrown if database or user is null or invalid
-
-