public class MysqlDataSource extends JdbcPropertySetImpl implements javax.sql.DataSource, javax.naming.Referenceable, java.io.Serializable, JdbcPropertySet
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
databaseName
Database Name
|
protected java.lang.String |
description |
protected java.lang.String |
encoding
Character Encoding
|
protected boolean |
explicitPort
Was the port explicitly set?
|
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 NonRegisteringDriver |
mysqlDriver
The driver to create connections with
|
protected java.lang.String |
password
Password
|
protected int |
port
Port number
|
protected java.lang.String |
profileSQLString
The profileSQL property
|
protected java.lang.String |
url
The JDBC URL
|
protected java.lang.String |
user
User name
|
Constructor and Description |
---|
MysqlDataSource()
Default no-arg constructor for Serialization
|
Modifier and Type | Method and Description |
---|---|
java.util.Properties |
exposeAsProperties() |
protected boolean |
getBooleanRuntimeProperty(java.lang.String name)
Used in properties getters added by instrumentation.
|
java.sql.Connection |
getConnection() |
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 pass) |
java.lang.String |
getDatabaseName()
Gets the name of the database
|
java.lang.String |
getDescription() |
protected java.lang.String |
getEnumRuntimeProperty(java.lang.String name)
Used in properties getters added by instrumentation.
|
protected int |
getIntegerRuntimeProperty(java.lang.String name)
Used in properties getters added by instrumentation.
|
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
protected long |
getLongRuntimeProperty(java.lang.String name)
Used in properties getters added by instrumentation.
|
protected int |
getMemorySizeRuntimeProperty(java.lang.String name)
Used in properties getters added by instrumentation.
|
java.util.logging.Logger |
getParentLogger() |
java.lang.String |
getPassword()
Get the password.
|
int |
getPort()
Returns the port number
|
int |
getPortNumber()
Returns the port number
|
javax.naming.Reference |
getReference()
Required method to support this class as a
Referenceable . |
java.lang.String |
getServerName()
Returns the name of the database server
|
protected java.lang.String |
getStringRuntimeProperty(java.lang.String name)
Used in properties getters added by instrumentation.
|
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
|
boolean |
isWrapperFor(java.lang.Class<?> iface) |
protected void |
setBooleanRuntimeProperty(java.lang.String name,
boolean value)
Used in properties setters added by instrumentation.
|
void |
setDatabaseName(java.lang.String dbName)
Sets the database name.
|
void |
setDescription(java.lang.String value) |
protected void |
setEnumRuntimeProperty(java.lang.String name,
java.lang.String value)
Used in properties setters added by instrumentation.
|
protected void |
setIntegerRuntimeProperty(java.lang.String name,
int value)
Used in properties setters added by instrumentation.
|
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter output) |
protected void |
setLongRuntimeProperty(java.lang.String name,
long value)
Used in properties setters added by instrumentation.
|
protected void |
setMemorySizeRuntimeProperty(java.lang.String name,
int value)
Used in properties setters added by instrumentation.
|
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 |
setPropertiesViaRef(javax.naming.Reference ref)
Initializes driver properties that come from a JNDI reference (in the
case of a javax.sql.DataSource bound into some name service that doesn't
handle Java objects directly).
|
void |
setServerName(java.lang.String serverName)
Sets the server name.
|
protected void |
setStringRuntimeProperty(java.lang.String name,
java.lang.String value)
Used in properties setters added by instrumentation.
|
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.
|
<T> T |
unwrap(java.lang.Class<T> iface) |
exposeAsDriverPropertyInfo, postInitialization
addProperty, getBooleanProperty, getBooleanProperty, getEnumProperty, getEnumProperty, getIntegerProperty, getIntegerProperty, getLongProperty, getLongProperty, getMemorySizeProperty, getMemorySizeProperty, getProperty, getProperty, getStringProperty, getStringProperty, initializeProperties, removeProperty, removeProperty, reset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exposeAsDriverPropertyInfo
addProperty, getBooleanProperty, getBooleanProperty, getEnumProperty, getEnumProperty, getIntegerProperty, getIntegerProperty, getLongProperty, getLongProperty, getMemorySizeProperty, getMemorySizeProperty, getProperty, getProperty, getStringProperty, getStringProperty, initializeProperties, postInitialization, removeProperty, removeProperty, reset
protected static final NonRegisteringDriver mysqlDriver
protected transient java.io.PrintWriter logWriter
protected java.lang.String databaseName
protected java.lang.String encoding
protected java.lang.String url
protected boolean explicitUrl
protected java.lang.String hostName
protected int port
protected boolean explicitPort
protected java.lang.String user
protected java.lang.String password
protected java.lang.String profileSQLString
protected java.lang.String description
public MysqlDataSource()
public java.sql.Connection getConnection() throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String userID, java.lang.String pass) throws java.sql.SQLException
getConnection
in interface javax.sql.DataSource
java.sql.SQLException
public java.lang.String getDescription()
public void setDescription(java.lang.String value)
public void setDatabaseName(java.lang.String dbName)
dbName
- the name of the databasepublic java.lang.String getDatabaseName()
public void setLogWriter(java.io.PrintWriter output) throws java.sql.SQLException
setLogWriter
in interface javax.sql.CommonDataSource
java.sql.SQLException
public java.io.PrintWriter getLogWriter()
getLogWriter
in interface javax.sql.CommonDataSource
public void setLoginTimeout(int seconds) throws java.sql.SQLException
setLoginTimeout
in interface javax.sql.CommonDataSource
java.sql.SQLException
public int getLoginTimeout()
getLoginTimeout
in interface javax.sql.CommonDataSource
public void setPassword(java.lang.String pass)
pass
- the passwordpublic java.lang.String getPassword()
public void setPort(int p)
p
- the portpublic int getPort()
public void setPortNumber(int p)
p
- the portpublic int getPortNumber()
public void setPropertiesViaRef(javax.naming.Reference ref) throws java.sql.SQLException
ref
- The JNDI Reference that holds RefAddrs for all propertiesjava.sql.SQLException
- if error occurspublic javax.naming.Reference getReference() throws javax.naming.NamingException
Referenceable
.getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
- if a JNDI error occurspublic void setServerName(java.lang.String serverName)
serverName
- the server namepublic java.lang.String getServerName()
public void setURL(java.lang.String url)
url
- the URL for this connectionpublic java.lang.String getURL()
public void setUrl(java.lang.String url)
url
- url to be used within driver.connectpublic java.lang.String getUrl()
public void setUser(java.lang.String userID)
userID
- the User IDpublic java.lang.String getUser()
protected java.sql.Connection getConnection(java.util.Properties props) throws java.sql.SQLException
props
- the properties to connect withjava.sql.SQLException
- if an error occurspublic java.util.logging.Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException
getParentLogger
in interface javax.sql.CommonDataSource
java.sql.SQLFeatureNotSupportedException
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException
unwrap
in interface java.sql.Wrapper
java.sql.SQLException
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
isWrapperFor
in interface java.sql.Wrapper
java.sql.SQLException
protected java.lang.String getStringRuntimeProperty(java.lang.String name) throws java.sql.SQLException
name
- property name property namejava.sql.SQLException
- if error occursprotected void setStringRuntimeProperty(java.lang.String name, java.lang.String value) throws java.sql.SQLException
name
- property namevalue
- valuejava.sql.SQLException
- if error occursprotected boolean getBooleanRuntimeProperty(java.lang.String name) throws java.sql.SQLException
name
- property namejava.sql.SQLException
- if error occursprotected void setBooleanRuntimeProperty(java.lang.String name, boolean value) throws java.sql.SQLException
name
- property namevalue
- valuejava.sql.SQLException
- if error occursprotected int getIntegerRuntimeProperty(java.lang.String name) throws java.sql.SQLException
name
- property namejava.sql.SQLException
- if error occursprotected void setIntegerRuntimeProperty(java.lang.String name, int value) throws java.sql.SQLException
name
- property namevalue
- valuejava.sql.SQLException
- if error occursprotected long getLongRuntimeProperty(java.lang.String name) throws java.sql.SQLException
name
- property namejava.sql.SQLException
- if error occursprotected void setLongRuntimeProperty(java.lang.String name, long value) throws java.sql.SQLException
name
- property namevalue
- valuejava.sql.SQLException
- if error occursprotected int getMemorySizeRuntimeProperty(java.lang.String name) throws java.sql.SQLException
name
- property namejava.sql.SQLException
- if error occursprotected void setMemorySizeRuntimeProperty(java.lang.String name, int value) throws java.sql.SQLException
name
- property namevalue
- valuejava.sql.SQLException
- if error occursprotected java.lang.String getEnumRuntimeProperty(java.lang.String name) throws java.sql.SQLException
name
- property namejava.sql.SQLException
- if error occursprotected void setEnumRuntimeProperty(java.lang.String name, java.lang.String value) throws java.sql.SQLException
name
- property namevalue
- valuejava.sql.SQLException
- if error occurspublic java.util.Properties exposeAsProperties()
exposeAsProperties
in interface PropertySet
exposeAsProperties
in class DefaultPropertySet