|
|||||||||
| Home >> All >> com >> mysql >> jdbc >> jdbc2 >> [ optional overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mysql.jdbc.jdbc2.optional
Class MysqlDataSource

java.lang.Objectcom.mysql.jdbc.jdbc2.optional.MysqlDataSource
- All Implemented Interfaces:
- javax.sql.DataSource, javax.naming.Referenceable, java.io.Serializable
- Direct Known Subclasses:
- MysqlConnectionPoolDataSource
- public class MysqlDataSource
- extends java.lang.Object
- implements javax.sql.DataSource, javax.naming.Referenceable, java.io.Serializable
- extends java.lang.Object
A JNDI DataSource for a Mysql JDBC connection
| Field Summary | |
protected java.lang.String |
databaseName
Database Name |
protected java.lang.String |
encoding
Character Encoding |
protected boolean |
explicitUrl
Should we construct the URL, or has it been set explicitly |
protected java.lang.String |
hostName
Hostname |
protected java.io.PrintWriter |
logWriter
Log stream |
protected static com.mysql.jdbc.Driver |
mysqlDriver
The driver to create connections with |
protected java.lang.String |
password
Password |
protected int |
port
Port number |
protected java.lang.String |
profileSql
The profileSql property |
protected java.lang.String |
url
The JDBC URL |
protected java.lang.String |
user
User name |
| Constructor Summary | |
MysqlDataSource()
Default no-arg constructor for Serialization |
|
| Method Summary | |
java.sql.Connection |
getConnection()
Creates a new connection using the already configured username and password. |
protected java.sql.Connection |
getConnection(java.util.Properties props)
Creates a connection using the specified properties. |
java.sql.Connection |
getConnection(java.lang.String userID,
java.lang.String password)
Creates a new connection with the given username and password |
java.lang.String |
getDatabaseName()
Gets the name of the database |
int |
getLoginTimeout()
Returns the login timeout |
java.io.PrintWriter |
getLogWriter()
Returns the log writer for this data source |
int |
getPort()
Returns the port number |
int |
getPortNumber()
Returns the port number |
java.lang.String |
getProfileSql()
Returns the value for the profileSql property |
javax.naming.Reference |
getReference()
Required method to support this class as a Referenceable. |
java.lang.String |
getServerName()
Returns the name of the database server |
java.lang.String |
getUrl()
Returns the JDBC URL that will be used to create the database connection. |
java.lang.String |
getURL()
Returns the URL for this connection |
java.lang.String |
getUser()
Returns the configured user for this connection |
void |
setDatabaseName(java.lang.String dbName)
Sets the database name. |
void |
setLoginTimeout(int seconds)
DOCUMENT ME! |
void |
setLogWriter(java.io.PrintWriter output)
Sets the log writer for this data source. |
void |
setPassword(java.lang.String pass)
Sets the password |
void |
setPort(int p)
Sets the database port. |
void |
setPortNumber(int p)
Sets the port number |
void |
setProfileSql(java.lang.String flag)
Sets the profileSql property |
void |
setServerName(java.lang.String serverName)
Sets the server name. |
void |
setUrl(java.lang.String url)
This method is used by the app server to set the url string specified within the datasource deployment descriptor. |
void |
setURL(java.lang.String url)
Sets the URL for this connection |
void |
setUser(java.lang.String userID)
Sets the user ID. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
mysqlDriver
protected static com.mysql.jdbc.Driver mysqlDriver
- The driver to create connections with
logWriter
protected transient java.io.PrintWriter logWriter
- Log stream
databaseName
protected java.lang.String databaseName
- Database Name
encoding
protected java.lang.String encoding
- Character Encoding
hostName
protected java.lang.String hostName
- Hostname
password
protected java.lang.String password
- Password
profileSql
protected java.lang.String profileSql
- The profileSql property
url
protected java.lang.String url
- The JDBC URL
user
protected java.lang.String user
- User name
explicitUrl
protected boolean explicitUrl
- Should we construct the URL, or has it been set explicitly
port
protected int port
- Port number
| Constructor Detail |
MysqlDataSource
public MysqlDataSource()
- Default no-arg constructor for Serialization
| Method Detail |
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
- Creates a new connection using the already configured username and
password.
- Specified by:
getConnectionin interfacejavax.sql.DataSource
getConnection
public java.sql.Connection getConnection(java.lang.String userID, java.lang.String password) throws java.sql.SQLException
- Creates a new connection with the given username and password
- Specified by:
getConnectionin interfacejavax.sql.DataSource
setDatabaseName
public void setDatabaseName(java.lang.String dbName)
- Sets the database name.
getDatabaseName
public java.lang.String getDatabaseName()
- Gets the name of the database
setLogWriter
public void setLogWriter(java.io.PrintWriter output) throws java.sql.SQLException
- Sets the log writer for this data source.
- Specified by:
setLogWriterin interfacejavax.sql.DataSource
getLogWriter
public java.io.PrintWriter getLogWriter()
- Returns the log writer for this data source
- Specified by:
getLogWriterin interfacejavax.sql.DataSource
setLoginTimeout
public void setLoginTimeout(int seconds)
throws java.sql.SQLException
- DOCUMENT ME!
- Specified by:
setLoginTimeoutin interfacejavax.sql.DataSource
getLoginTimeout
public int getLoginTimeout()
- Returns the login timeout
- Specified by:
getLoginTimeoutin interfacejavax.sql.DataSource
setPassword
public void setPassword(java.lang.String pass)
- Sets the password
setPort
public void setPort(int p)
- Sets the database port.
getPort
public int getPort()
- Returns the port number
setPortNumber
public void setPortNumber(int p)
- Sets the port number
getPortNumber
public int getPortNumber()
- Returns the port number
setProfileSql
public void setProfileSql(java.lang.String flag)
- Sets the profileSql property
getProfileSql
public java.lang.String getProfileSql()
- Returns the value for the profileSql property
getReference
public javax.naming.Reference getReference() throws javax.naming.NamingException
- Required method to support this class as a
Referenceable.- Specified by:
getReferencein interfacejavax.naming.Referenceable
setServerName
public void setServerName(java.lang.String serverName)
- Sets the server name.
getServerName
public java.lang.String getServerName()
- Returns the name of the database server
setURL
public void setURL(java.lang.String url)
- Sets the URL for this connection
getURL
public java.lang.String getURL()
- Returns the URL for this connection
setUrl
public void setUrl(java.lang.String url)
- This method is used by the app server to set the url string specified
within the datasource deployment descriptor. It is discovered using
introspection and matches if property name in descriptor is "url".
getUrl
public java.lang.String getUrl()
- Returns the JDBC URL that will be used to create the database
connection.
setUser
public void setUser(java.lang.String userID)
- Sets the user ID.
getUser
public java.lang.String getUser()
- Returns the configured user for this connection
getConnection
protected java.sql.Connection getConnection(java.util.Properties props) throws java.sql.SQLException
- Creates a connection using the specified properties.
|
|||||||||
| Home >> All >> com >> mysql >> jdbc >> jdbc2 >> [ optional overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.mysql.jdbc.jdbc2.optional.MysqlDataSource