com.metamatrix.jdbc
Class MMDataSource

java.lang.Object
  extended by com.metamatrix.jdbc.WrapperImpl
      extended by com.metamatrix.jdbc.BaseDataSource
          extended by com.metamatrix.jdbc.MMDataSource
All Implemented Interfaces:
java.io.Serializable, java.sql.Wrapper, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource, javax.sql.DataSource, javax.sql.XADataSource

public class MMDataSource
extends BaseDataSource

The MetaMatrix JDBC DataSource implementation class of DataSource and XADataSource.

The DataSource interface follows the JavaBean design pattern, meaning the implementation class has properties that are accessed with getter methods and set using setter methods, and where the getter and setter methods follow the JavaBean naming convention (e.g., getPropertyName() : PropertyType and setPropertyName(PropertyType) : void).

The XADataSource interface is almost identical to the DataSource interface, but rather than returning Connection instances, there are methods that return XAConnection instances that can be used with distributed transactions.

The following are the properties for this DataSource:

Property NameTypeDescription
portNumber int The port number where a MetaMatrix Server is listening for requests.
serverName StringThe hostname or IP address of the MetaMatrix Server.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.metamatrix.jdbc.BaseDataSource
APP_NAME, DEFAULT_APP_NAME, DEFAULT_FETCH_SIZE, DEFAULT_LOG_LEVEL, DEFAULT_PARTIAL_RESULTS_MODE, DEFAULT_RESULT_SET_CACHE_MODE, DEFAULT_TIMEOUT, JDBC, METAMATRIX_PROTOCOL, PASSWORD, TXN_AUTO_WRAP_OFF, TXN_AUTO_WRAP_ON, TXN_AUTO_WRAP_OPTIMISTIC, TXN_AUTO_WRAP_PESSIMISTIC, USER_NAME, VDB_NAME, VDB_VERSION, VERSION
 
Constructor Summary
MMDataSource()
          Constructor for MMDataSource.
 
Method Summary
protected  java.util.Properties buildProperties(java.lang.String userName, java.lang.String password)
           
protected  java.lang.String buildServerURL()
           
protected  java.lang.String buildURL()
           
 java.lang.String getAlternateServers()
          Returns a string containing a comma delimited list of alternate MetaMatrix Server(s).
 java.lang.String getAutoFailover()
           
 java.sql.Connection getConnection()
          Attempt to establish a database connection.
 java.sql.Connection getConnection(java.lang.String userName, java.lang.String password)
          Attempt to establish a database connection.
 java.lang.String getCredentials()
          Returns the credentials string defining credentials to use with connectors for per-user logon.
 java.lang.String getDiscoveryStrategy()
           
 int getPortNumber()
          Returns the port number.
 java.lang.String getServerName()
          Returns the name of the MetaMatrix Server.
 boolean isSecure()
          Returns a flag indicating whether to create a secure connection or not.
static java.lang.String reasonWhyInvalidAlternateServers(java.lang.String alternateServers)
          The reason why "alternateServers" is invalid.
static java.lang.String reasonWhyInvalidPortNumber(int portNumber)
          Return the reason why the supplied port number may be invalid, or null if it is considered valid.
static java.lang.String reasonWhyInvalidServerName(java.lang.String serverName)
          Return the reason why the supplied server name may be invalid, or null if it is considered valid.
static java.lang.String reasonWhyInvalidSocketsPerVM(java.lang.String socketsPerVM)
          The reason why "socketsPerVM" is invalid.
static java.lang.String reasonWhyInvalidStickyConnections(java.lang.String stickyConnections)
          The reason why "stickyConnections" is invalid.
 void setAlternateServers(java.lang.String servers)
          Sets a list of alternate MetaMatrix Sserver(s) that can be used for connection fail-over.
 void setAutoFailover(java.lang.String autoFailover)
           
 void setCredentials(java.lang.String credentials)
          Sets the credentials string defining credentials to use with connectors for per-user logon.
 void setDiscoveryStrategy(java.lang.String discoveryStrategy)
           
 void setPortNumber(int portNumber)
          Sets the portNumber.
 void setSecure(boolean secure)
          Sets the secure flag to use mms: protocol instead of the default mm: protocol.
 void setServerName(java.lang.String serverName)
          Sets the serverName.
 java.lang.String toString()
           
protected  void validateProperties(java.lang.String userName, java.lang.String password)
           
 
Methods inherited from class com.metamatrix.jdbc.BaseDataSource
getAdditionalProperties, getApplicationName, getClientToken, getDatabaseName, getDatabaseVersion, getDataSourceName, getDescription, getDisableLocalTxn, getFetchSize, getLoginTimeout, getLogWriter, getPartialResultsMode, getPassword, getPooledConnection, getPooledConnection, getResourceMessage, getResultSetCacheMode, getSqlOptions, getTransactionAutoWrap, getUser, getXAConnection, getXAConnection, reasonWhyInvalidApplicationName, reasonWhyInvalidClientToken, reasonWhyInvalidDatabaseName, reasonWhyInvalidDatabaseVersion, reasonWhyInvalidDataSourceName, reasonWhyInvalidDescription, reasonWhyInvalidFetchSize, reasonWhyInvalidPartialResultsMode, reasonWhyInvalidPassword, reasonWhyInvalidTransactionAutoWrap, reasonWhyInvalidUser, setAdditionalProperties, setApplicationName, setClientToken, setDatabaseName, setDatabaseVersion, setDataSourceName, setDescription, setDisableLocalTxn, setFetchSize, setLoginTimeout, setLogWriter, setPartialResultsMode, setPassword, setResultSetCacheMode, setSqlOptions, setTransactionAutoWrap, setUser
 
Methods inherited from class com.metamatrix.jdbc.WrapperImpl
isWrapperFor, unwrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Constructor Detail

MMDataSource

public MMDataSource()
Constructor for MMDataSource.

Method Detail

buildProperties

protected java.util.Properties buildProperties(java.lang.String userName,
                                               java.lang.String password)
Overrides:
buildProperties in class BaseDataSource

buildServerURL

protected java.lang.String buildServerURL()

buildURL

protected java.lang.String buildURL()

validateProperties

protected void validateProperties(java.lang.String userName,
                                  java.lang.String password)
                           throws java.sql.SQLException
Overrides:
validateProperties in class BaseDataSource
Throws:
java.sql.SQLException

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Attempt to establish a database connection.

Specified by:
getConnection in interface javax.sql.DataSource
Overrides:
getConnection in class BaseDataSource
Returns:
a Connection to the database
Throws:
java.sql.SQLException - if a database-access error occurs
See Also:
DataSource.getConnection()

getConnection

public java.sql.Connection getConnection(java.lang.String userName,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Attempt to establish a database connection.

Parameters:
userName - the database user on whose behalf the Connection is being made
password - the user's password
Returns:
a Connection to the database
Throws:
java.sql.SQLException - if a database-access error occurs
See Also:
DataSource.getConnection(java.lang.String, java.lang.String)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getPortNumber

public int getPortNumber()
Returns the port number.

Returns:
the port number

getServerName

public java.lang.String getServerName()
Returns the name of the MetaMatrix Server.

Returns:
the name of the MetaMatrix Server

getCredentials

public java.lang.String getCredentials()
Returns the credentials string defining credentials to use with connectors for per-user logon.

Since:
4.3.2

isSecure

public boolean isSecure()
Returns a flag indicating whether to create a secure connection or not.

Returns:
True if using secure mms: protocol, false for normal mm: protocol.
Since:
5.0.2

getAlternateServers

public java.lang.String getAlternateServers()
Returns a string containing a comma delimited list of alternate MetaMatrix Server(s). The list will be in the form of server2[:port2][,server3[:port3]]. If no alternate servers have been defined null is returned.

Returns:
A comma delimited list of server:port or null If no alternate servers are defined.
Since:
5.5

setPortNumber

public void setPortNumber(int portNumber)
Sets the portNumber.

Parameters:
portNumber - The portNumber to set

setServerName

public void setServerName(java.lang.String serverName)
Sets the serverName.

Parameters:
serverName - The serverName to set

setCredentials

public void setCredentials(java.lang.String credentials)
Sets the credentials string defining credentials to use with connectors for per-user logon.

Since:
4.3.2

setSecure

public void setSecure(boolean secure)
Sets the secure flag to use mms: protocol instead of the default mm: protocol.

Parameters:
secure - True to use mms:
Since:
5.0.2

setAlternateServers

public void setAlternateServers(java.lang.String servers)
Sets a list of alternate MetaMatrix Sserver(s) that can be used for connection fail-over. The form of the list should be server2[:port2][,server3:[port3][,...]]. If ":port" is omitted, the port defined by portNumber is used. If servers is empty or null, the value of alternateServers is cleared.

Parameters:
servers - A comma delimited list of alternate MetaMatrix Server(s):Port(s) to use for connection fail-over. If blank or null, the list is cleared.
Since:
5.5

reasonWhyInvalidPortNumber

public static java.lang.String reasonWhyInvalidPortNumber(int portNumber)
Return the reason why the supplied port number may be invalid, or null if it is considered valid.

Parameters:
portNumber - a possible value for the property
Returns:
the reason why the property is invalid, or null if it is considered valid
See Also:
setPortNumber(int)

reasonWhyInvalidServerName

public static java.lang.String reasonWhyInvalidServerName(java.lang.String serverName)
Return the reason why the supplied server name may be invalid, or null if it is considered valid.

Parameters:
serverName - a possible value for the property
Returns:
the reason why the property is invalid, or null if it is considered valid
See Also:
setServerName(String)

reasonWhyInvalidSocketsPerVM

public static java.lang.String reasonWhyInvalidSocketsPerVM(java.lang.String socketsPerVM)
The reason why "socketsPerVM" is invalid.

Parameters:
value - of "socketsPerVM" property
Returns:
reason

reasonWhyInvalidStickyConnections

public static java.lang.String reasonWhyInvalidStickyConnections(java.lang.String stickyConnections)
The reason why "stickyConnections" is invalid.

Parameters:
value - of "stickyConnections" property
Returns:
reason

reasonWhyInvalidAlternateServers

public static java.lang.String reasonWhyInvalidAlternateServers(java.lang.String alternateServers)
The reason why "alternateServers" is invalid.

Parameters:
value - of "alternateServers" property
Returns:
reason

getAutoFailover

public java.lang.String getAutoFailover()
Returns:
Returns the transparentFailover.

setAutoFailover

public void setAutoFailover(java.lang.String autoFailover)
Parameters:
transparentFailover - The transparentFailover to set.

getDiscoveryStrategy

public java.lang.String getDiscoveryStrategy()

setDiscoveryStrategy

public void setDiscoveryStrategy(java.lang.String discoveryStrategy)


Copyright © 2009. All Rights Reserved.