|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.cjdbc.driver.DataSource
An implementation of the JDBC 2.0 optional package DataSource
interface. It allows to set the URL, user name, and password to its
properties. It can be bound via JNDI so that the properties can be set by an
"application server" and a "ready-to-use" reference to DataSource
can be retrieved via JNDI.
Field Summary | |
protected static java.lang.String |
DESCRIPTION_PROPERTY
|
protected static Driver |
driver
Wrapped driver for to get connections. |
protected static java.lang.String |
DRIVER_CLASSNAME
|
protected static java.lang.String |
FACTORY_CLASSNAME
|
protected java.io.PrintWriter |
logWriter
|
protected java.lang.String |
password
|
protected static java.lang.String |
PASSWORD_PROPERTY
|
protected java.lang.String |
url
DataSource properties |
protected static java.lang.String |
URL_PROPERTY
DataSource properties |
protected java.lang.String |
user
|
protected static java.lang.String |
USER_PROPERTY
|
Constructor Summary | |
DataSource()
Default constructor. |
Method Summary | |
java.sql.Connection |
getConnection()
Gets connection. |
protected java.sql.Connection |
getConnection(java.util.Properties props)
Creates a connection using the specified properties. |
java.sql.Connection |
getConnection(java.lang.String user,
java.lang.String password)
Gets connection. |
java.lang.String |
getDescription()
Return the description of this Datasource with the Driver version number. |
int |
getLoginTimeout()
Gets the login timeout. |
java.io.PrintWriter |
getLogWriter()
Gets the log writer. |
javax.naming.Reference |
getReference()
Gets a reference to this. |
java.lang.String |
getUrl()
Gets url of the C-JDBC controller(s) to connect. |
java.lang.String |
getURL()
Gets URL of the C-JDBC controller(s) to connect. |
java.lang.String |
getUser()
Gets user name to be used to connect the C-JDBC controller(s). |
void |
setLoginTimeout(int seconds)
Sets the timeout. |
void |
setLogWriter(java.io.PrintWriter output)
Sets the log writer for this data source. |
void |
setPassword(java.lang.String pwd)
Sets password to be used to connect the C-JDBC controller(s). |
void |
setUrl(java.lang.String url)
Sets url of the C-JDBC controller(s) to connect. |
void |
setURL(java.lang.String url)
Sets URL of the C-JDBC controller(s) to connect. |
void |
setUser(java.lang.String userName)
Sets user name to be used to connect the C-JDBC controller(s). |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String URL_PROPERTY
protected static final java.lang.String USER_PROPERTY
protected static final java.lang.String PASSWORD_PROPERTY
protected static final java.lang.String DRIVER_CLASSNAME
protected static final java.lang.String FACTORY_CLASSNAME
protected static final java.lang.String DESCRIPTION_PROPERTY
protected static Driver driver
protected java.lang.String url
protected java.lang.String user
protected java.lang.String password
protected java.io.PrintWriter logWriter
Constructor Detail |
public DataSource()
Method Detail |
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
- if an error occurs.public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
user
- user name.password
- password.
java.sql.SQLException
- if an error occurs.public void setLogWriter(java.io.PrintWriter output) throws java.sql.SQLException
setLogWriter
in interface javax.sql.DataSource
output
- print writer.
java.sql.SQLException
- in case of an error occurs.public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.DataSource
public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.DataSource
seconds
- timeout in seconds.
java.sql.SQLException
- in case of an error occurs.public int getLoginTimeout() throws java.sql.SQLException
getLoginTimeout
in interface javax.sql.DataSource
java.sql.SQLException
- in case of an error occurs.public javax.naming.Reference getReference() throws javax.naming.NamingException
DataSourceFactory
class.
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
- if DataSourceFactory
not found.public java.lang.String getDescription()
public void setUrl(java.lang.String url)
URL_PROPERTY
property.
url
- URL to be used to connect C-JDBC controller(s)public void setURL(java.lang.String url)
url
- URL to be used to connect C-JDBC controller(s).public java.lang.String getUrl()
URL_PROPERTY
property.
public java.lang.String getURL()
URL_PROPERTY
property.
public void setUser(java.lang.String userName)
USER_PROPERTY
property.
userName
- user name to be used to connect C-JDBC controller(s).public java.lang.String getUser()
USER_PROPERTY
property.
public void setPassword(java.lang.String pwd)
PASSWORD_PROPERTY
property. Note that there is not a getPassword
method.
pwd
- password to be used to connect C-JDBC controller(s).protected java.sql.Connection getConnection(java.util.Properties props) throws java.sql.SQLException
props
- connection properties.
java.sql.SQLException
- if an error occurs.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |