public class StandardDataSource extends CoreDataSource implements javax.sql.DataSource
This class is generic in the sense that it does not rely upon anything other than standard Java APIs. It uses java.sql.DriverManager and preconfigured properties to construct a JDBC connection. Important : networkProtocol, portNumber, serverName are not used. Please use instead the url property.
logWriter, password, user
Modifier | Constructor and Description |
---|---|
|
StandardDataSource()
Constructors
|
protected |
StandardDataSource(java.sql.Driver drv) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String u,
java.lang.String p) |
java.lang.String |
getDriverName()
return the name of the driver
|
java.lang.Object |
getObjectInstance(java.lang.Object refObj,
javax.naming.Name name,
javax.naming.Context nameCtx,
java.util.Hashtable env)
Methods inherited from ObjectFactory
|
java.util.logging.Logger |
getParentLogger() |
javax.naming.Reference |
getReference()
Methods inherited from referenceable
|
int |
getTransactionIsolation()
return the transaction isolation level defined for the current database
|
java.lang.String |
getUrl()
return the url of the database
|
int |
hashCode() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setDriverName(java.lang.String driverName)
set the name of the jdbc driver
|
void |
setTransactionIsolation(int level)
set the level of the transaction isolation for the current database
|
void |
setUrl(java.lang.String url)
set the database url
|
java.lang.String |
toString() |
<T> T |
unwrap(java.lang.Class<T> iface) |
getDescription, getLoginTimeout, getLogWriter, getPassword, getThreadFactory, getUser, isDebug, isVerbose, setDebug, setDescription, setLoginTimeout, setLogWriter, setPassword, setThreadFactory, setUser, setVerbose, shutdown
public StandardDataSource()
protected StandardDataSource(java.sql.Driver drv) throws java.sql.SQLException
java.sql.SQLException
public java.lang.String getDriverName()
public java.lang.String getUrl()
public void setDriverName(java.lang.String driverName) throws java.sql.SQLException
driverName
- the string representation of the jdbc driver namejava.sql.SQLException
public void setUrl(java.lang.String url)
url
- the string representation of the database urlpublic void setTransactionIsolation(int level)
level
- the integer levelpublic int getTransactionIsolation()
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String u, java.lang.String p) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
u
- p
- java.sql.SQLException
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
getReference
in class CoreDataSource
javax.naming.NamingException
public java.lang.Object getObjectInstance(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable env) throws java.lang.Exception
getObjectInstance
in interface javax.naming.spi.ObjectFactory
getObjectInstance
in class CoreDataSource
java.lang.Exception
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class CoreDataSource
public int hashCode()
hashCode
in class java.lang.Object
public java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
getParentLogger
in interface javax.sql.CommonDataSource
java.sql.SQLFeatureNotSupportedException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException