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, shutdownpublic StandardDataSource()
protected StandardDataSource(java.sql.Driver drv)
throws java.sql.SQLException
java.sql.SQLExceptionpublic 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.SQLExceptionpublic 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.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String u,
java.lang.String p)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourceu - p - java.sql.SQLExceptionpublic javax.naming.Reference getReference()
throws javax.naming.NamingException
getReference in interface javax.naming.ReferenceablegetReference in class CoreDataSourcejavax.naming.NamingExceptionpublic 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.ObjectFactorygetObjectInstance in class CoreDataSourcejava.lang.Exceptionpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class CoreDataSourcepublic int hashCode()
hashCode in class java.lang.Objectpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedExceptionpublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLException