public class SQLConnection extends Object implements org.pentaho.platform.engine.core.system.IPentahoLoggingConnection, org.pentaho.commons.connection.ILimitableConnection
Modifier and Type | Field and Description |
---|---|
static int |
CONCUR_READONLY |
static int |
CONCUR_UPDATABLE |
protected Connection |
nativeConnection |
static int |
RESULTSET_FORWARDONLY |
static int |
RESULTSET_SCROLLABLE |
CLASSNAME_KEY, CONNECTION, CONNECTION_NAME, DRIVER_KEY, HQL_DATASOURCE, JNDI_NAME_KEY, KEYS, LOCATION_KEY, MDX_DATASOURCE, MDX_OLAP4J_DATASOURCE, NONE_DATASOURCE, PASSWORD_KEY, PROVIDER, QUERY_KEY, SQL_DATASOURCE, USERNAME_KEY, XML_DATASOURCE
Constructor and Description |
---|
SQLConnection() |
SQLConnection(String driverName,
String location,
String userName,
String password,
org.pentaho.platform.api.engine.ILogger logger) |
Modifier and Type | Method and Description |
---|---|
protected Connection |
captureConnection(Connection connection)
Allow wrapping/proxying of the native SQL connection by a subclass.
|
void |
clearWarnings() |
void |
close() |
boolean |
connect(Properties props) |
protected void |
enhanceConnection(Connection connection)
Allows the native SQL Connection to be enhanced in a subclass.
|
protected void |
enhanceStatement(Statement statement)
Allows the native SQL Statement to be enhanced by a subclass.
|
int |
execute(String query) |
int |
execute(String query,
int scrollType,
int concur) |
org.pentaho.commons.connection.IPentahoResultSet |
executeQuery(String query)
Executes the specified query.
|
org.pentaho.commons.connection.IPentahoResultSet |
executeQuery(String query,
int scrollType,
int concur)
Executes the specified query with the defined parameters
|
String |
getDatasourceType()
return datasource type SQL
|
int |
getFetchSize() |
String |
getLastQuery() |
int |
getMaxRows() |
Connection |
getNativeConnection() |
int |
getQueryTimeout()
Returns the query timeout value (in seconds)
|
boolean |
getReadOnly()
Returns the state of the readonly flag
|
org.pentaho.commons.connection.IPentahoResultSet |
getResultSet() |
protected void |
init(String driverName,
String location,
String userName,
String password) |
boolean |
initialized() |
protected void |
initWithJNDI(String jndiName) |
boolean |
isClosed() |
boolean |
isFallBackToNonscrollableOnError() |
boolean |
isForcedForwardOnly() |
boolean |
isReadOnly() |
org.pentaho.commons.connection.IPentahoResultSet |
prepareAndExecuteQuery(String query,
List parameters) |
org.pentaho.commons.connection.IPentahoResultSet |
prepareAndExecuteQuery(String query,
List parameters,
int scrollType,
int concur) |
boolean |
preparedQueriesSupported() |
void |
setFallBackToNonscrollableOnError(boolean fallBackToNonscrollableOnError) |
void |
setFetchSize(int fetchSize) |
void |
setForcedForwardOnly(boolean forcedForwardOnly) |
void |
setLogger(org.pentaho.platform.api.engine.ILogger logger) |
void |
setMaxRows(int maxRows) |
void |
setProperties(Properties props) |
void |
setQueryTimeout(int timeInSec)
Sets the valid of the timeout (in seconds)
|
void |
setReadOnly(boolean value)
Sets the connection object to readonly.
|
protected void |
setStatementLimitations(Statement stmt)
The purpose of this method is to set limitations such as fetchSize and maxrows on the provided statement.
|
protected void |
unEnhanceConnection(Connection connection)
Allows enhancements to the native SQL Connection to be removed in a subclass.
|
protected Connection nativeConnection
public static final int RESULTSET_SCROLLABLE
public static final int RESULTSET_FORWARDONLY
public static final int CONCUR_READONLY
public static final int CONCUR_UPDATABLE
public void setLogger(org.pentaho.platform.api.engine.ILogger logger)
setLogger
in interface org.pentaho.platform.engine.core.system.IPentahoLoggingConnection
public void setProperties(Properties props)
setProperties
in interface org.pentaho.commons.connection.IPentahoConnection
public void setQueryTimeout(int timeInSec)
setQueryTimeout
in interface org.pentaho.commons.connection.ILimitableConnection
public void setReadOnly(boolean value)
value
- public int getQueryTimeout()
public boolean initialized()
initialized
in interface org.pentaho.commons.connection.IPentahoConnection
public String getDatasourceType()
getDatasourceType
in interface org.pentaho.commons.connection.IPentahoConnection
protected void initWithJNDI(String jndiName)
protected void enhanceConnection(Connection connection) throws SQLException
connection
- SQLException
protected void unEnhanceConnection(Connection connection) throws SQLException
connection
- SQLException
protected Connection captureConnection(Connection connection) throws SQLException
connection
- SQLException
protected void enhanceStatement(Statement statement) throws SQLException
statement
- SQLException
public void close()
close
in interface org.pentaho.commons.connection.IPentahoConnection
public String getLastQuery()
getLastQuery
in interface org.pentaho.commons.connection.IPentahoConnection
public org.pentaho.commons.connection.IPentahoResultSet executeQuery(String query) throws SQLException, InterruptedException, org.pentaho.platform.api.engine.PentahoSystemException
executeQuery
in interface org.pentaho.commons.connection.IPentahoConnection
query
- the query to executeSQLException
- indicates an error running the queryInterruptedException
- indicates that the query took longer than the allowed timeout valueorg.pentaho.platform.api.engine.PentahoSystemException
public org.pentaho.commons.connection.IPentahoResultSet executeQuery(String query, int scrollType, int concur) throws SQLException, InterruptedException, org.pentaho.platform.api.engine.PentahoSystemException
query
- the query to be executedscrollType
- concur
- SQLException
- indicates an error running the queryInterruptedException
- indicates the query took longer than allowable by the query timeoutorg.pentaho.platform.api.engine.PentahoSystemException
public org.pentaho.commons.connection.IPentahoResultSet prepareAndExecuteQuery(String query, List parameters) throws SQLException
prepareAndExecuteQuery
in interface org.pentaho.commons.connection.IPentahoConnection
SQLException
protected void setStatementLimitations(Statement stmt) throws SQLException
stmt
- Either a Statement or PreparedStatementSQLException
- , UnsupportedOperationExceptionpublic org.pentaho.commons.connection.IPentahoResultSet prepareAndExecuteQuery(String query, List parameters, int scrollType, int concur) throws SQLException
SQLException
public boolean preparedQueriesSupported()
preparedQueriesSupported
in interface org.pentaho.commons.connection.IPentahoConnection
public boolean isClosed()
isClosed
in interface org.pentaho.commons.connection.IPentahoConnection
public boolean isReadOnly()
isReadOnly
in interface org.pentaho.commons.connection.IPentahoConnection
public void clearWarnings()
clearWarnings
in interface org.pentaho.commons.connection.IPentahoConnection
public org.pentaho.commons.connection.IPentahoResultSet getResultSet()
getResultSet
in interface org.pentaho.commons.connection.IPentahoConnection
public boolean connect(Properties props)
connect
in interface org.pentaho.commons.connection.IPentahoConnection
public int execute(String query) throws SQLException
SQLException
public int execute(String query, int scrollType, int concur) throws SQLException
SQLException
public Connection getNativeConnection()
public int getFetchSize()
public void setFetchSize(int fetchSize)
setFetchSize
in interface org.pentaho.commons.connection.IPentahoConnection
fetchSize
- The fetchSize to set.public int getMaxRows()
public void setMaxRows(int maxRows)
setMaxRows
in interface org.pentaho.commons.connection.ILimitableConnection
setMaxRows
in interface org.pentaho.commons.connection.IPentahoConnection
maxRows
- The maxRows to set.public boolean getReadOnly()
public void setFallBackToNonscrollableOnError(boolean fallBackToNonscrollableOnError)
public boolean isFallBackToNonscrollableOnError()
public boolean isForcedForwardOnly()
public void setForcedForwardOnly(boolean forcedForwardOnly)
Copyright © 2021 Hitachi Vantara. All rights reserved.