public class JNDIConnectionProvider extends java.lang.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(java.lang.String jndiUrl,
boolean alwaysLookup)
Constructor
|
JNDIConnectionProvider(java.lang.String jndiUrl,
java.util.Properties jndiProps,
boolean alwaysLookup)
Constructor
|
Modifier and Type | Method and Description |
---|---|
java.sql.Connection |
getConnection() |
boolean |
isAlwaysLookup() |
void |
setAlwaysLookup(boolean b) |
void |
shutdown() |
public JNDIConnectionProvider(java.lang.String jndiUrl, boolean alwaysLookup)
jndiUrl
- The url for the datasourcepublic JNDIConnectionProvider(java.lang.String jndiUrl, java.util.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.public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface ConnectionProvider
java.sql.SQLException
public boolean isAlwaysLookup()
public void setAlwaysLookup(boolean b)
public void shutdown() throws java.sql.SQLException
shutdown
in interface ConnectionProvider
java.sql.SQLException