public class SQLConnection extends Object implements 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,
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(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(ILogger logger)
setLogger in interface IPentahoLoggingConnectionpublic void setProperties(Properties props)
setProperties in interface org.pentaho.commons.connection.IPentahoConnectionpublic void setQueryTimeout(int timeInSec)
setQueryTimeout in interface org.pentaho.commons.connection.ILimitableConnectionpublic void setReadOnly(boolean value)
value - public int getQueryTimeout()
public boolean initialized()
initialized in interface org.pentaho.commons.connection.IPentahoConnectionpublic String getDatasourceType()
getDatasourceType in interface org.pentaho.commons.connection.IPentahoConnectionprotected void initWithJNDI(String jndiName)
protected void enhanceConnection(Connection connection) throws SQLException
connection - SQLExceptionprotected void unEnhanceConnection(Connection connection) throws SQLException
connection - SQLExceptionprotected Connection captureConnection(Connection connection) throws SQLException
connection - SQLExceptionprotected void enhanceStatement(Statement statement) throws SQLException
statement - SQLExceptionpublic void close()
close in interface org.pentaho.commons.connection.IPentahoConnectionpublic String getLastQuery()
getLastQuery in interface org.pentaho.commons.connection.IPentahoConnectionpublic org.pentaho.commons.connection.IPentahoResultSet executeQuery(String query) throws SQLException, InterruptedException, PentahoSystemException
executeQuery in interface org.pentaho.commons.connection.IPentahoConnectionquery - the query to executeSQLException - indicates an error running the queryInterruptedException - indicates that the query took longer than the allowed timeout valuePentahoSystemExceptionpublic org.pentaho.commons.connection.IPentahoResultSet executeQuery(String query, int scrollType, int concur) throws SQLException, InterruptedException, 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 timeoutPentahoSystemExceptionpublic org.pentaho.commons.connection.IPentahoResultSet prepareAndExecuteQuery(String query, List parameters) throws SQLException
prepareAndExecuteQuery in interface org.pentaho.commons.connection.IPentahoConnectionSQLExceptionprotected 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
SQLExceptionpublic boolean preparedQueriesSupported()
preparedQueriesSupported in interface org.pentaho.commons.connection.IPentahoConnectionpublic boolean isClosed()
isClosed in interface org.pentaho.commons.connection.IPentahoConnectionpublic boolean isReadOnly()
isReadOnly in interface org.pentaho.commons.connection.IPentahoConnectionpublic void clearWarnings()
clearWarnings in interface org.pentaho.commons.connection.IPentahoConnectionpublic org.pentaho.commons.connection.IPentahoResultSet getResultSet()
getResultSet in interface org.pentaho.commons.connection.IPentahoConnectionpublic boolean connect(Properties props)
connect in interface org.pentaho.commons.connection.IPentahoConnectionpublic int execute(String query) throws SQLException
SQLExceptionpublic int execute(String query, int scrollType, int concur) throws SQLException
SQLExceptionpublic Connection getNativeConnection()
public int getFetchSize()
public void setFetchSize(int fetchSize)
setFetchSize in interface org.pentaho.commons.connection.IPentahoConnectionfetchSize - The fetchSize to set.public int getMaxRows()
public void setMaxRows(int maxRows)
setMaxRows in interface org.pentaho.commons.connection.ILimitableConnectionsetMaxRows in interface org.pentaho.commons.connection.IPentahoConnectionmaxRows - The maxRows to set.public boolean getReadOnly()
public void setFallBackToNonscrollableOnError(boolean fallBackToNonscrollableOnError)
public boolean isFallBackToNonscrollableOnError()
public boolean isForcedForwardOnly()
public void setForcedForwardOnly(boolean forcedForwardOnly)
Copyright © 2017 Hitachi Vantara. All rights reserved.