|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.sadun.util.pool.connection.ConfigurableDataSource
A non-pooled data source (use ConnectionPool
to pool it
if needed) which can be externally configured via standard XML serialization.
An example of XML encoding follows:
<?xml version="1.0" encoding="UTF-8"?> <java version="1.4.1_03" class="java.beans.XMLDecoder"> <object class="org.sadun.util.pool.connection.ConfigurableDataSource"> <void property="connectionProperties"> <void method="put"> <string>fooProperty</string> <string>fooValue</string> </void> </void> <void property="jdbcUrl"> <string>jdbc:microsoft:sqlserver://localhost:1433;User=sa;Password=;DatabaseName=ipm</string> </void> </object> </java>
Constructor Summary | |
ConfigurableDataSource()
Create an unitialized ConfigurableDataSource. |
|
ConfigurableDataSource(java.io.File xmlPath)
Create an datasource from an XMLEncoded file. |
|
ConfigurableDataSource(java.io.InputStream xml)
Create an datasource from an XMLEncoded stream. |
|
ConfigurableDataSource(java.lang.String jdbcUrl)
Create an datasource using the given JDBC url. |
|
ConfigurableDataSource(java.lang.String jdbcUrl,
java.util.Properties connectionProperties)
Create an datasource using the given JDBC url and connection properties. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Return true if the given object is a ConfigurableDataSource with identical JDBC url and connection properties, else false. |
java.sql.Connection |
getConnection()
See DataSource . |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password)
See DataSource . |
java.util.Properties |
getConnectionProperties()
Return the connection properties for this data source. |
java.lang.String |
getJdbcUrl()
Return the JDBC url for this data source. |
int |
getLoginTimeout()
See DataSource . |
java.io.PrintWriter |
getLogWriter()
See DataSource . |
int |
hashCode()
Return an hash code for the object. |
static void |
main(java.lang.String[] args)
|
void |
setConnectionProperties(java.util.Properties connectionProperties)
Set the connection properties for this data source. |
void |
setJdbcUrl(java.lang.String jdbcUrl)
Set the JDBC url for this data source. |
void |
setLoginTimeout(int seconds)
See DataSource . |
void |
setLogWriter(java.io.PrintWriter out)
See DataSource . |
java.lang.String |
toString()
Return a description of the data source. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public ConfigurableDataSource()
setJdbcUrl()
must be invoked before invoking
getConnection()
.
public ConfigurableDataSource(java.lang.String jdbcUrl)
jdbcUrl
- the JDBC url to use.public ConfigurableDataSource(java.lang.String jdbcUrl, java.util.Properties connectionProperties)
jdbcUrl
- the JDBC url to use.connectionProperties
- the connection properties to use.public ConfigurableDataSource(java.io.InputStream xml)
xml
- the XMLEncoded stream to create the datasource from.public ConfigurableDataSource(java.io.File xmlPath) throws java.io.FileNotFoundException
Method Detail |
public java.sql.Connection getConnection() throws java.sql.SQLException
DataSource
.
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getConnection()
public java.sql.Connection getConnection(java.lang.String username, java.lang.String password) throws java.sql.SQLException
DataSource
.
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getConnection(java.lang.String, java.lang.String)
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
DataSource
.
getLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getLogWriter()
public void setLogWriter(java.io.PrintWriter out) throws java.sql.SQLException
DataSource
.
setLogWriter
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.setLogWriter(java.io.PrintWriter)
public void setLoginTimeout(int seconds) throws java.sql.SQLException
DataSource
.
setLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.setLoginTimeout(int)
public int getLoginTimeout() throws java.sql.SQLException
DataSource
.
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
DataSource.getLoginTimeout()
public java.util.Properties getConnectionProperties()
public java.lang.String getJdbcUrl()
public void setConnectionProperties(java.util.Properties connectionProperties)
connectionProperties
- public void setJdbcUrl(java.lang.String jdbcUrl)
jdbcUrl
- public java.lang.String toString()
public boolean equals(java.lang.Object obj)
public int hashCode()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |