com.f1j.data.source
Class JDBC

java.lang.Object
  |
  +--com.actuate.util.Debug
        |
        +--com.f1j.util.Debug
              |
              +--com.f1j.util.ObjConst
                    |
                    +--com.f1j.util.Obj
                          |
                          +--com.f1j.util.AbstractIndexObj
                                |
                                +--com.f1j.util.SharedIndexObj
                                      |
                                      +--com.f1j.data.source.SourceImpl
                                            |
                                            +--com.f1j.data.source.JDBC

public class JDBC
extends com.f1j.data.source.SourceImpl
implements Source, Query, ParameterizedQuery

This class processes JDBC data sources.

See Also:
DatabaseQuery

Field Summary
static int CF_OPTIMIZE_FOR_CONNECTION_POOL_USE
          Flag indicating to only hold open a database connection long enough to process a single query.
static int CF_USE_SINGLE_CONNECTION_FOR_ALL_QUERIES
          Flag indicating to use a single database connection for all queries associated with this source.
static int kConnectionIsOracle
          Indicates that this connection is to an Oracle database.
 
Method Summary
 java.util.Properties getAdvancedConnectionProperties()
          Returns a copy of the Java java.util.Properties object.
 int getConnectionUseOptimizationFlag()
          Returns value indicating how database connections are managed.
 java.lang.String getDatabase()
          Returns the URL of the database for this connection.
 java.lang.String getDriverName()
          Returns the JDBC driver associated with this JDBC data source.
 java.lang.String getJndiName()
          Returns the JNDI name for the data source.
 java.lang.String getPassword()
          Returns the password needed to access this data source.
 java.lang.String getUserName()
          Returns the user name needed to access this data source.
 boolean isContainsParameters()
          Deprecated. As of 9.0, use DatabaseQueryParamCollection.isContainsInputParameters instead.
 void set(java.lang.String strDriver, java.lang.String strURL, java.lang.String strUser, java.lang.String strPassword, boolean bUpdateMetaData)
          Sets driver name, database URL, user name, password for a data source.
 void setAdvancedConnectionProperties(java.util.Properties props)
          Sets or clears the advanced connection properties for the current database URL.
 void setConnection(java.sql.Connection userSuppliedConnection)
          Sets user-created JDBC connection.
 void setConnection(java.sql.Connection userSuppliedConnection, int flags)
          Sets user-created JDBC connection.
 void setConnectionUseOptimizationFlag(int flag)
          Sets flag affecting how database connections are managed.
 void setDatabase(java.lang.String database)
          Sets the URL of the database for this data source connection.
 void setDriverName(java.lang.String driverName)
          Sets the driver for this data source connection.
 void setJndiName(java.lang.String name)
          Sets the JNDI name for the data source.
 void setPassword(java.lang.String password)
          Sets the password used to access this data source.
 void setUserName(java.lang.String userName)
          Sets the user name used to access this data source.
 

Field Detail

kConnectionIsOracle

public static final int kConnectionIsOracle
Indicates that this connection is to an Oracle database.
See Also:
setConnection(java.sql.Connection, int)
Since:
12.0.2

CF_USE_SINGLE_CONNECTION_FOR_ALL_QUERIES

public static final int CF_USE_SINGLE_CONNECTION_FOR_ALL_QUERIES
Flag indicating to use a single database connection for all queries associated with this source. This is the default mode. When in this mode, a database connection is opened upon the first refresh of this data source, and is kept open for the life of the application.
See Also:
CF_OPTIMIZE_FOR_CONNECTION_POOL_USE, setConnectionUseOptimizationFlag(int), getConnectionUseOptimizationFlag()

CF_OPTIMIZE_FOR_CONNECTION_POOL_USE

public static final int CF_OPTIMIZE_FOR_CONNECTION_POOL_USE
Flag indicating to only hold open a database connection long enough to process a single query. Each query refresh will initiate a database connection, process the query, and close the connection.
See Also:
CF_USE_SINGLE_CONNECTION_FOR_ALL_QUERIES, setConnectionUseOptimizationFlag(int), getConnectionUseOptimizationFlag()
Method Detail

getConnectionUseOptimizationFlag

public int getConnectionUseOptimizationFlag()
Returns value indicating how database connections are managed.
Returns:
current connection use optimization mode
See Also:
setConnectionUseOptimizationFlag(int), CF_USE_SINGLE_CONNECTION_FOR_ALL_QUERIES, CF_OPTIMIZE_FOR_CONNECTION_POOL_USE

setConnectionUseOptimizationFlag

public void setConnectionUseOptimizationFlag(int flag)
Sets flag affecting how database connections are managed.
Parameters:
flag - either CF_USE_SINGLE_CONNECTION_FOR_ALL_QUERIES or CF_OPTIMIZE_FOR_CONNECTION_POOL_USE.
See Also:
getConnectionUseOptimizationFlag(), CF_USE_SINGLE_CONNECTION_FOR_ALL_QUERIES, CF_OPTIMIZE_FOR_CONNECTION_POOL_USE

getAdvancedConnectionProperties

public java.util.Properties getAdvancedConnectionProperties()
Returns a copy of the Java java.util.Properties object. Returns null if no advanced properties have been set.
Returns:
a copy of the Java java.util.Properties object or null if no advanced properties are set.
See Also:
setAdvancedConnectionProperties(java.util.Properties), getDatabase(), setDatabase(java.lang.String), java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties)

setAdvancedConnectionProperties

public void setAdvancedConnectionProperties(java.util.Properties props)
Sets or clears the advanced connection properties for the current database URL. If the advanced properties are set using this method, the database URL set in setDatabase is ignored, along with the username or password properties set by setUserName and setPassword. Since the previous URL, username and password properties are ignored, the corresponding properties should be included in the Properties object passed in with this method. Also, note that this method makes a copy of the Properties object passed in; it does not store a reference to the Properties object.

To clear the advanced properties, call this method with null.

Parameters:
props - a list of string pairs in the form tag:value or tag=value as used in java.util.Properties for connection arguments. "Normally at least a 'user' and 'password' property should be included."
See Also:
getAdvancedConnectionProperties(), getDatabase(), setDatabase(java.lang.String), java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties)

getJndiName

public java.lang.String getJndiName()
Returns the JNDI name for the data source.
Returns:
a string indicating the name.
See Also:
setJndiName(java.lang.String)

setJndiName

public void setJndiName(java.lang.String name)
Sets the JNDI name for the data source. Must be a fully qualified JNDI name, (e.g., "java:comp/env/jdbc/jndiNameOfDataSource").
Parameters:
name - a string indicating the JNDI name.
See Also:
getJndiName()

getDatabase

public java.lang.String getDatabase()
Returns the URL of the database for this connection.
Returns:
a text string of the database URL.
See Also:
setDatabase(java.lang.String), setAdvancedConnectionProperties(java.util.Properties)

getDriverName

public java.lang.String getDriverName()
Returns the JDBC driver associated with this JDBC data source.
Returns:
the name of the driver.
See Also:
setDriverName(java.lang.String)

getUserName

public java.lang.String getUserName()
Returns the user name needed to access this data source.
Returns:
a text string of the user name.
See Also:
setUserName(java.lang.String)

getPassword

public java.lang.String getPassword()
Returns the password needed to access this data source.
Returns:
text string of password.
See Also:
setPassword(java.lang.String)

isContainsParameters

public boolean isContainsParameters()
Deprecated. As of 9.0, use DatabaseQueryParamCollection.isContainsInputParameters instead.
Returns whether this data source contains parameters.
Returns:
boolean: true/false

setDatabase

public void setDatabase(java.lang.String database)
Sets the URL of the database for this data source connection. If the source has a DriverTemplateInfo object, then this will be wiped out when an URL is explicitly designed. This means that the next time the source is edited then the UI will use the generic JDBC UI.
Parameters:
database - text string of the URL.
See Also:
getDatabase()

setDriverName

public void setDriverName(java.lang.String driverName)
Sets the driver for this data source connection.
Parameters:
driverName - the name of the driver for this connection.
See Also:
getDriverName()

setUserName

public void setUserName(java.lang.String userName)
Sets the user name used to access this data source.
Parameters:
userName - text string of the user name.
See Also:
getUserName()

setPassword

public void setPassword(java.lang.String password)
Sets the password used to access this data source.
Parameters:
password - text string of the password.
See Also:
getPassword()

set

public void set(java.lang.String strDriver,
                java.lang.String strURL,
                java.lang.String strUser,
                java.lang.String strPassword,
                boolean bUpdateMetaData)
Sets driver name, database URL, user name, password for a data source. It will run the query to get metadata if told to do so.
Parameters:
strDriver - If null then driver is not set otherwise it is only set when it does not match the current driver.
strURL - If null then database URL is not set otherwise it is only set when it does not match the current URL.
strUser - If null then user is not set otherwise it is only set when it does not match the current user.
strPassword - If null then password is not set otherwise it is only set when it does not match the current password.
bUpdateMetaData - If true then all attached queries will be ran to update metadata(table names, column names, etc.). If you know metadata is NOT changed pass false

setConnection

public void setConnection(java.sql.Connection userSuppliedConnection)
Sets user-created JDBC connection.
Parameters:
userSuppliedConnection - a previously created java.sql.Connection to use instead of the e.Spreadsheet database, driver, username and password properties.
See Also:
setDatabase(java.lang.String), setDriverName(java.lang.String), setUserName(java.lang.String), setPassword(java.lang.String)

setConnection

public void setConnection(java.sql.Connection userSuppliedConnection,
                          int flags)
Sets user-created JDBC connection.
Parameters:
userSuppliedConnection - a previously created java.sql.Connection to use instead of the e.Spreadsheet database, driver, username and password properties.
flags - Connection attributes. kConnectionIsOracle 0x0001 Set to force the connection to be treated as a connection to an Oracle database.
Since:
12.0.2
See Also:
kConnectionIsOracle, setDatabase(java.lang.String), setDriverName(java.lang.String), setUserName(java.lang.String), setPassword(java.lang.String)