Package org.teiid.jdbc
Class TeiidDataSource
- java.lang.Object
-
- org.teiid.jdbc.WrapperImpl
-
- org.teiid.jdbc.BaseDataSource
-
- org.teiid.jdbc.TeiidDataSource
-
- All Implemented Interfaces:
Serializable
,Wrapper
,CommonDataSource
,ConnectionPoolDataSource
,DataSource
,XADataSource
public class TeiidDataSource extends BaseDataSource
The Teiid JDBC DataSource implementation class ofDataSource
andXADataSource
.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.,get
PropertyName() :
PropertyType andset
PropertyName(
PropertyType) : void
). TheXADataSource
interface is almost identical to theDataSource
interface, but rather than returningConnection
instances, there are methods that returnXAConnection
instances that can be used with distributed transactions.The following are the properties for this DataSource:
Property Name Type Description portNumber int
The port number where a Teiid Server is listening for requests. serverName String
The hostname or IP address of the Teiid Server. - See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.teiid.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, PASSWORD, TXN_WRAP_AUTO, TXN_WRAP_OFF, TXN_WRAP_ON, USER_NAME, VDB_NAME, VDB_VERSION, VERSION
-
-
Constructor Summary
Constructors Constructor Description TeiidDataSource()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected Properties
buildProperties(String userName, String password)
protected String
buildServerURL()
protected JDBCURL
buildURL()
String
getAlternateServers()
Returns a string containing a comma delimited list of alternate server(s).String
getAutoFailover()
Connection
getConnection()
Attempt to establish a database connection.Connection
getConnection(String userName, String password)
Attempt to establish a database connection.boolean
getEncryptRequests()
String
getJaasName()
Application name from JAAS Login Config fileString
getKerberosServicePrincipleName()
Kerberos KDC service principle nameboolean
getLoadBalance()
Deprecated.Logger
getParentLogger()
boolean
getPassthroughAuthentication()
Same as "isPassthroughAuthentication".int
getPortNumber()
Returns the port number.boolean
getSecure()
Same as "isSecure".String
getServerName()
Returns the name of the server.XAConnection
getXAConnection(String userName, String password)
Attempt to establish a database connection that can be used with distributed transactions.boolean
isEncryptRequests()
boolean
isLoadBalance()
Deprecated.boolean
isPassthroughAuthentication()
When true, this connection uses the passed in security domain to do the authentication.boolean
isSecure()
Returns a flag indicating whether to create a secure connection or not.static String
reasonWhyInvalidPortNumber(int portNumber)
Return the reason why the supplied port number may be invalid, or null if it is considered valid.static String
reasonWhyInvalidServerName(String serverName)
Return the reason why the supplied server name may be invalid, or null if it is considered valid.static String
reasonWhyInvalidSocketsPerVM(String socketsPerVM)
The reason why "socketsPerVM" is invalid.static String
reasonWhyInvalidStickyConnections(String stickyConnections)
The reason why "stickyConnections" is invalid.void
setAlternateServers(String servers)
Sets a list of alternate server(s) that can be used for connection fail-over.void
setAutoFailover(String autoFailover)
void
setEncryptRequests(boolean encryptRequests)
void
setJaasName(String jaasApplicationName)
Application name from JAAS Login Config filevoid
setKerberosServicePrincipleName(String kerberosServerName)
Kerberos KDC service principle namevoid
setLoadBalance(boolean loadBalance)
Deprecated.void
setPassthroughAuthentication(boolean passthroughAuthentication)
When set to true, the connection uses the passed in security domain to do the authentication.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(String serverName)
Sets the serverName.String
toString()
protected void
validateProperties(String userName, String password)
-
Methods inherited from class org.teiid.jdbc.BaseDataSource
getAdditionalProperties, getApplicationName, getAutoCommitTxn, getDatabaseName, getDatabaseVersion, getDataSourceName, getDescription, getDisableLocalTxn, getFetchSize, getLoginTimeout, getLogWriter, getPartialResultsMode, getPassword, getPooledConnection, getPooledConnection, getQueryTimeout, getResultSetCacheMode, getShowPlan, getUseJDBC4ColumnNameAndLabelSemantics, getUser, getXAConnection, isAnsiQuotedIdentifiers, isNoExec, reasonWhyInvalidApplicationName, reasonWhyInvalidDatabaseName, reasonWhyInvalidDatabaseVersion, reasonWhyInvalidDataSourceName, reasonWhyInvalidDescription, reasonWhyInvalidFetchSize, reasonWhyInvalidPartialResultsMode, reasonWhyInvalidPassword, reasonWhyInvalidTransactionAutoWrap, reasonWhyInvalidUser, setAdditionalProperties, setAnsiQuotedIdentifiers, setApplicationName, setAutoCommitTxn, setDatabaseName, setDatabaseVersion, setDataSourceName, setDescription, setDisableLocalTxn, setFetchSize, setLoginTimeout, setLogWriter, setNoExec, setPartialResultsMode, setPassword, setQueryTimeout, setResultSetCacheMode, setShowPlan, setUseJDBC4ColumnNameAndLabelSemantics, setUser
-
Methods inherited from class org.teiid.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
-
-
-
-
Method Detail
-
buildProperties
protected Properties buildProperties(String userName, String password)
- Overrides:
buildProperties
in classBaseDataSource
-
buildServerURL
protected String buildServerURL() throws TeiidSQLException
- Throws:
TeiidSQLException
-
buildURL
protected JDBCURL buildURL() throws TeiidSQLException
- Throws:
TeiidSQLException
-
validateProperties
protected void validateProperties(String userName, String password) throws SQLException
- Overrides:
validateProperties
in classBaseDataSource
- Throws:
SQLException
-
getConnection
public Connection getConnection() throws SQLException
Attempt to establish a database connection.- Specified by:
getConnection
in interfaceDataSource
- Overrides:
getConnection
in classBaseDataSource
- Returns:
- a Connection to the database
- Throws:
SQLException
- if a database-access error occurs- See Also:
DataSource.getConnection()
-
getConnection
public Connection getConnection(String userName, String password) throws SQLException
Attempt to establish a database connection.- Parameters:
userName
- the database user on whose behalf the Connection is being madepassword
- the user's password- Returns:
- a Connection to the database
- Throws:
SQLException
- if a database-access error occurs- See Also:
DataSource.getConnection(java.lang.String, java.lang.String)
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
Object.toString()
-
getPortNumber
public int getPortNumber()
Returns the port number.- Returns:
- the port number
-
getServerName
public String getServerName()
Returns the name of the server.- Returns:
- the name of the server
-
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
-
getSecure
public boolean getSecure()
Same as "isSecure". Required by the reflection login in connection pools to identify the type- Returns:
-
getAlternateServers
public String getAlternateServers()
Returns a string containing a comma delimited list of alternate server(s). The list will be in the form of server2[:port2][,server3[:port3]]. If no alternate servers have been definednull
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(String serverName)
Sets the serverName.- Parameters:
serverName
- The serverName to set
-
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(String servers)
Sets a list of alternate server(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 byportNumber
is used. Ifservers
is empty ornull
, the value ofalternateServers
is cleared.- Parameters:
servers
- A comma delimited list of alternate Server(s):Port(s) to use for connection fail-over. If blank ornull
, the list is cleared.- Since:
- 5.5
-
reasonWhyInvalidPortNumber
public static 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 String reasonWhyInvalidServerName(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 String reasonWhyInvalidSocketsPerVM(String socketsPerVM)
The reason why "socketsPerVM" is invalid.- Parameters:
socketsPerVM
- property- Returns:
- reason
-
reasonWhyInvalidStickyConnections
public static String reasonWhyInvalidStickyConnections(String stickyConnections)
The reason why "stickyConnections" is invalid.- Parameters:
stickyConnections
- property- Returns:
- reason
-
getAutoFailover
public String getAutoFailover()
- Returns:
- Returns the transparentFailover.
-
setAutoFailover
public void setAutoFailover(String autoFailover)
- Parameters:
autoFailover
- The transparentFailover to set.
-
isPassthroughAuthentication
public boolean isPassthroughAuthentication()
When true, this connection uses the passed in security domain to do the authentication.- Returns:
-
getPassthroughAuthentication
public boolean getPassthroughAuthentication()
Same as "isPassthroughAuthentication". Required by the reflection login in connection pools to identify the type- Returns:
-
setPassthroughAuthentication
public void setPassthroughAuthentication(boolean passthroughAuthentication)
When set to true, the connection uses the passed in security domain to do the authentication.- Since:
- 7.1
-
getJaasName
public String getJaasName()
Application name from JAAS Login Config file- Returns:
- Since:
- 7.6
-
setJaasName
public void setJaasName(String jaasApplicationName)
Application name from JAAS Login Config file- Since:
- 7.6
-
getKerberosServicePrincipleName
public String getKerberosServicePrincipleName()
Kerberos KDC service principle name- Returns:
- Since:
- 7.6
-
setKerberosServicePrincipleName
public void setKerberosServicePrincipleName(String kerberosServerName)
Kerberos KDC service principle name- Since:
- 7.6
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Throws:
SQLFeatureNotSupportedException
-
setEncryptRequests
public void setEncryptRequests(boolean encryptRequests)
-
isEncryptRequests
public boolean isEncryptRequests()
-
getEncryptRequests
public boolean getEncryptRequests()
-
isLoadBalance
@Deprecated public boolean isLoadBalance()
Deprecated.
-
getLoadBalance
@Deprecated public boolean getLoadBalance()
Deprecated.
-
setLoadBalance
@Deprecated public void setLoadBalance(boolean loadBalance)
Deprecated.
-
getXAConnection
public XAConnection getXAConnection(String userName, String password) throws SQLException
Attempt to establish a database connection that can be used with distributed transactions.- Parameters:
userName
- the database user on whose behalf the XAConnection is being madepassword
- the user's password- Returns:
- an XAConnection to the database
- Throws:
SQLException
- if a database-access error occurs- See Also:
XADataSource.getXAConnection(java.lang.String, java.lang.String)
-
-