public class SJDataSource
extends java.lang.Object
implements javax.sql.DataSource
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
driver |
private java.lang.String |
password |
private java.lang.String |
poolUrl
if a connection pool has been built, its url is stored in here
|
private java.util.Properties |
properties |
private java.io.PrintWriter |
pw |
private java.lang.String |
url |
private java.lang.String |
username |
| Constructor and Description |
|---|
SJDataSource(java.lang.String driver,
java.lang.String url,
java.lang.String username,
java.lang.String password,
java.util.Properties properties) |
| Modifier and Type | Method and Description |
|---|---|
private static boolean |
ensureLoaded(java.lang.String name) |
boolean |
equals(java.lang.Object obj) |
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
returns a connection to the database specified in the properties and
creates a connection pool, if neccessary
|
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
int |
hashCode() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setLoginTimeout(int timeout) |
void |
setLogWriter(java.io.PrintWriter pw) |
java.lang.String |
toString() |
<T> T |
unwrap(java.lang.Class<T> iface) |
private java.io.PrintWriter pw
private java.lang.String username
private java.lang.String password
private java.lang.String url
private java.lang.String driver
private java.util.Properties properties
private java.lang.String poolUrl
public SJDataSource(java.lang.String driver,
java.lang.String url,
java.lang.String username,
java.lang.String password,
java.util.Properties properties)
private static boolean ensureLoaded(java.lang.String name)
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
getLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic int getLoginTimeout()
throws java.sql.SQLException
getLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLogWriter(java.io.PrintWriter pw)
throws java.sql.SQLException
setLogWriter in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic void setLoginTimeout(int timeout)
throws java.sql.SQLException
setLoginTimeout in interface javax.sql.CommonDataSourcejava.sql.SQLExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic 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.SQLExceptionpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedException