Public Member Functions | |
DataSource () | |
java.sql.Connection | getConnection () throws SQLException |
java.sql.Connection | getConnection (String user, String password) throws SQLException |
void | setLogWriter (PrintWriter output) throws SQLException |
java.io.PrintWriter | getLogWriter () |
void | setLoginTimeout (int seconds) throws SQLException |
int | getLoginTimeout () throws SQLException |
Reference | getReference () throws NamingException |
String | getDescription () |
void | setUrl (String url) |
void | setURL (String url) |
String | getUrl () |
String | getURL () |
void | setUser (String userName) |
String | getUser () |
void | setPassword (String pwd) |
Protected Member Functions | |
java.sql.Connection | getConnection (Properties props) throws SQLException |
Protected Attributes | |
String | url = null |
String | user = null |
String | password = null |
PrintWriter | logWriter = null |
Static Protected Attributes | |
final String | URL_PROPERTY = "url" |
final String | USER_PROPERTY = Driver.USER_PROPERTY |
final String | PASSWORD_PROPERTY = Driver.PASSWORD_PROPERTY |
final String | DRIVER_CLASSNAME = "org.objectweb.cjdbc.driver.Driver" |
final String | FACTORY_CLASSNAME = "org.objectweb.cjdbc.driver.DataSourceFactory" |
final String | DESCRIPTION_PROPERTY = "description" |
Driver | driver = null |
Static Package Functions | |
[static initializer] |
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.
Definition at line 47 of file DataSource.java.
|
Default constructor. Definition at line 85 of file DataSource.java. 00086 { 00087 }
|
|
Creates a connection using the specified properties.
Definition at line 302 of file DataSource.java. References org.objectweb.cjdbc.driver.Driver.connect(), org.objectweb.cjdbc.driver.DataSource.driver, and org.objectweb.cjdbc.driver.DataSource.url. 00304 { 00305 return driver.connect(url, props); 00306 }
|
|
Gets connection. Retrieves a new connection using the user name and password specified.
Definition at line 113 of file DataSource.java. References org.objectweb.cjdbc.driver.DataSource.getConnection(). 00115 { 00116 if (user == null) 00117 { 00118 user = ""; 00119 } 00120 if (password == null) 00121 { 00122 password = ""; 00123 } 00124 Properties props = new Properties(); 00125 props.put(USER_PROPERTY, user); 00126 props.put(PASSWORD_PROPERTY, password); 00127 00128 return getConnection(props); 00129 }
|
|
Gets connection. Retrieves a new connection using the user name and password that have been already set.
Definition at line 99 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSource.getConnection(). 00100 { 00101 return getConnection(user, password); 00102 }
|
|
Return the description of this Datasource with the Driver version number.
Definition at line 202 of file DataSource.java. References org.objectweb.cjdbc.driver.DataSource.driver, org.objectweb.cjdbc.driver.Driver.getMajorVersion(), and org.objectweb.cjdbc.driver.Driver.getMinorVersion(). Referenced by org.objectweb.cjdbc.driver.DataSource.getReference(). 00203 { 00204 return "C-JDBC " + driver.getMajorVersion() + "." 00205 + driver.getMinorVersion() + " Datasource"; 00206 }
|
|
Gets the login timeout.
Definition at line 168 of file DataSource.java. 00169 {
00170 return 0;
00171 }
|
|
Gets the log writer.
Definition at line 147 of file DataSource.java. 00148 {
00149 return logWriter;
00150 }
|
|
Gets a reference to this. The factory used for this class is the DataSourceFactoryclass.
Definition at line 183 of file DataSource.java. References org.objectweb.cjdbc.driver.DataSource.getDescription(), org.objectweb.cjdbc.driver.DataSource.getUrl(), org.objectweb.cjdbc.driver.DataSource.getUser(), and org.objectweb.cjdbc.driver.DataSource.URL_PROPERTY. 00184 { 00185 Reference ref = new Reference(getClass().getName(), FACTORY_CLASSNAME, null); 00186 ref.add(new StringRefAddr(DESCRIPTION_PROPERTY, getDescription())); 00187 ref.add(new StringRefAddr(USER_PROPERTY, getUser())); 00188 ref.add(new StringRefAddr(PASSWORD_PROPERTY, password)); 00189 ref.add(new StringRefAddr(URL_PROPERTY, getUrl())); 00190 return ref; 00191 }
|
|
Gets URL of the C-JDBC controller(s) to connect. The URL is stored in the URL_PROPERTYproperty.
Definition at line 249 of file DataSource.java. References org.objectweb.cjdbc.driver.DataSource.getUrl(). 00250 { 00251 return getUrl(); 00252 }
|
|
Gets url of the C-JDBC controller(s) to connect. The URL is stored in the URL_PROPERTYproperty.
Definition at line 238 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSource.getReference(), and org.objectweb.cjdbc.driver.DataSource.getURL(). 00239 {
00240 return url;
00241 }
|
|
Gets user name to be used to connect the C-JDBC controller(s). The user name is stored in the USER_PROPERTYproperty.
Definition at line 273 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSource.getReference(). 00274 {
00275 return user;
00276 }
|
|
Sets the timeout. Actually does nothing.
Definition at line 158 of file DataSource.java. 00159 { 00160 }
|
|
Sets the log writer for this data source.
Definition at line 137 of file DataSource.java. 00138 { 00139 logWriter = output; 00140 }
|
|
Sets password to be used to connect the C-JDBC controller(s). The method can be used by the "application server" to set the password (potentially according a deployment descriptor). The password is stored in the PASSWORD_PROPERTYproperty. Note that there is not a
Definition at line 287 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSourceFactory.getObjectInstance(). 00288 { 00289 password = pwd; 00290 }
|
|
Sets URL of the C-JDBC controller(s) to connect. The method is used by the "application server" to set the URL (potentially according a deployment descriptor). The URL is stored in the "url" property.
Definition at line 227 of file DataSource.java. References org.objectweb.cjdbc.driver.DataSource.setUrl(). 00228 { 00229 setUrl(url); 00230 }
|
|
Sets url of the C-JDBC controller(s) to connect. The method is used by the "application server" to set the URL (potentially according a deployment descriptor). The url is stored in the URL_PROPERTYproperty.
Definition at line 215 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSourceFactory.getObjectInstance(), and org.objectweb.cjdbc.driver.DataSource.setURL(). 00216 {
00217 this.url = url;
00218 }
|
|
Sets user name to be used to connect the C-JDBC controller(s). The method can be used by the "application server" to set the user name (potentially according a deployment descriptor). The user name is stored in the USER_PROPERTYproperty.
Definition at line 262 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSourceFactory.getObjectInstance(). 00263 { 00264 user = userName; 00265 }
|
|
Wrapped driver for to get connections. Definition at line 63 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSource.getConnection(), and org.objectweb.cjdbc.driver.DataSource.getDescription(). |
|
DataSource properties Definition at line 77 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSource.getConnection(). |
|
DataSource properties Definition at line 55 of file DataSource.java. Referenced by org.objectweb.cjdbc.driver.DataSource.getReference(). |