public class JNDIConnectionProvider extends Object implements ConnectionProvider
A ConnectionProvider
that provides connections from a DataSource
that is managed by an application server, and made available via JNDI.
DBConnectionManager
,
ConnectionProvider
,
PoolingConnectionProvider
Constructor and Description |
---|
JNDIConnectionProvider(String jndiUrl,
boolean alwaysLookup)
Constructor
|
JNDIConnectionProvider(String jndiUrl,
Properties jndiProps,
boolean alwaysLookup)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Connection |
getConnection() |
protected org.slf4j.Logger |
getLog() |
void |
initialize() |
boolean |
isAlwaysLookup() |
void |
setAlwaysLookup(boolean b) |
void |
shutdown() |
public JNDIConnectionProvider(String jndiUrl, boolean alwaysLookup)
jndiUrl
- The url for the datasourcepublic JNDIConnectionProvider(String jndiUrl, Properties jndiProps, boolean alwaysLookup)
jndiUrl
- The URL for the DataSourcejndiProps
- The JNDI properties to use when establishing the InitialContext
for the lookup of the given URL.protected org.slf4j.Logger getLog()
public Connection getConnection() throws SQLException
getConnection
in interface ConnectionProvider
SQLException
public boolean isAlwaysLookup()
public void setAlwaysLookup(boolean b)
public void shutdown() throws SQLException
shutdown
in interface ConnectionProvider
SQLException
public void initialize() throws SQLException
initialize
in interface ConnectionProvider
SQLException
Copyright 2001-2019, Terracotta, Inc.