public class DataSourceConnectionSpec extends AbstractConnectionSpec
DataSource API.InitialContext| Constructor and Description |
|---|
DataSourceConnectionSpec(String jndiName) |
DataSourceConnectionSpec(String jndiName,
boolean autoCommitEnabled)
Creates an instance that will get connections from the database with the
specified JNDI name.
|
DataSourceConnectionSpec(String jndiName,
Hashtable<?,?> environment,
String user,
String password) |
DataSourceConnectionSpec(String jndiName,
Hashtable<?,?> environment,
String user,
String password,
boolean autoCommitEnabled)
Creates an instance that will get connections from the database with the
specified JNDI name using the specified username and password.
|
DataSourceConnectionSpec(String jndiName,
String user,
String password) |
DataSourceConnectionSpec(String jndiName,
String user,
String password,
boolean autoCommitEnabled)
Creates an instance that will get connections from the database with the
specified JNDI name using the specified username and password.
|
| Modifier and Type | Method and Description |
|---|---|
void |
accept(ConnectionSpecVisitor connectionSpecVisitor)
Performs some processing on this connection spec.
|
DataSource |
getDataSource()
Gets the specified data source.
|
Connection |
getOrCreate()
Creates a database connection or gets an existing connection with the
JNDI name, username and password specified in the constructor.
|
getDatabaseProduct, getDatabaseVersion, getDriver, getDriverVersion, isAutoCommitEnabledpublic DataSourceConnectionSpec(String jndiName, boolean autoCommitEnabled) throws NamingException
jndiName - a JNDI name String.NamingException - if the specified JNDI name is invalid.public DataSourceConnectionSpec(String jndiName) throws NamingException
NamingExceptionpublic DataSourceConnectionSpec(String jndiName, String user, String password, boolean autoCommitEnabled) throws NamingException
InitialContext for a description of environment
properties.jndiName - a JNDI name String.user - a username String.password - a password String.NamingException - if an error occurs during JNDI lookup.public DataSourceConnectionSpec(String jndiName, String user, String password) throws NamingException
NamingExceptionpublic DataSourceConnectionSpec(String jndiName, Hashtable<?,?> environment, String user, String password) throws NamingException
NamingExceptionpublic DataSourceConnectionSpec(String jndiName, Hashtable<?,?> environment, String user, String password, boolean autoCommitEnabled) throws NamingException
InitialContext for a description of environment
properties.jndiName - a JNDI name String.environment - a Hashtable of environment properties.user - a username String.password - a password String.NamingException - if an error occurs during JNDI lookup.public Connection getOrCreate() throws SQLException
Connection.SQLException - if an error occurred creating/getting a
Connection, possibly because the JNDI name, username and/or
password are invalid.public DataSource getDataSource()
DataSource.public void accept(ConnectionSpecVisitor connectionSpecVisitor)
ConnectionSpecconnectionSpecVisitor - a ConnectionSpecVisitor.Copyright © 2012–2017 Emory University. All rights reserved.