i-net Clear Reports

com.inet.report.config.datasource
Class DataSourceConfiguration

java.lang.Object
  extended by com.inet.report.config.datasource.DataSourceConfiguration
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable

public class DataSourceConfiguration
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable

A DataSourceConfiguration is a description for a data source, that can be used by an i-net Clear Reports report.
We differentiate between a data source use a JDBC driver and a data source use a com.inet.report.database.DataFactory extended class. In last case the report data will be set directly by Database class. In first case i-net Clear Reports use the settings of this data source configuration to establish a JDBC connection to a database server. Then it requests the data via SQL statements.
At execution time of the report, i-net Clear Reports creates the connection to the database, based on this settings.

If i-net Clear Reports runs inside of an application server, it will try to find a connection via JNDI.
The path to receive the DataSource from application server is : "java:comp/env/jdbc/"+DataSourceConfiguration.
If no data source was found, i-net Clear Reports creates the connection by itself.

Typical a DataSourceConfiguration will be created with the GUI but you can also create it via API.
Example for a DataSourceConfiguration based on a Database class:


 DataSourceConfiguration dsc = DataSourceConfigurationManager.createDataSourceConfiguration( "myFirstDSC", DataSourceConfigurationManager.TEMPORARY_PREFERENCES );
 dsc.setDatabaseClassname( "com.company.DatabaseImpl" );
 dsc.setDriverLibrary( "c:/lib/reportclasses.jar" );//you can also set an URL
 dsc.save( DataSourceConfigurationManager.TEMPORARY_PREFERENCES ); //-> manager->store
 
Samples for own Database classes can be found in sample library at:
samples.jdbc.DatabaseClassUsableInDesigner
samples.jdbc.DataWithExternalResultSet
samples.jdbc.DataWithoutJDBC

Example for a DataSourceConfiguration based on a JDBC driver / database connection:
 
 DataSourceConfiguration dsc = DataSourceConfigurationManager.createDataSourceConfiguration( "myFirstDSC", DataSourceConfigurationManager.TEMPORARY_PREFERENCES );
 dsc.addProperty( DataSourceConfiguration.PROPERTY_DRIVER_CLASSNAME, "com.inet.tds.TdsDriver" );//MS SQL Server driver from i-net software
 dsc.addProperty( DataSourceConfiguration.PROPERTY_URL, "jdbc:inetdae7" );
 dsc.addProperty( DataSourceConfiguration.PROPERTY_USER, "sa" );
 dsc.addProperty( DataSourceConfiguration.PROPERTY_PASSWORD, "xxxx" );
 dsc.addProperty( "host", "localhost");        //a driver specific property
 dsc.addProperty( "database", "northwind" );   //a driver specific property
 dsc.save( DataSourceConfigurationManager.TEMPORARY_PREFERENCES ); //-> manager->store
 
 ...
 
 create a new report based on this datasource configuration
 
 Engine e = RDC.createEmptyEngine();
 Datasource ds = e.getDatabaseTables().createDatasource("myFirstDSC");
 TableSource ts = ds.create...

 switch an existing Datasource to a DataSourceConfiguration
 
 Engine eng = new Engine();
 eng.setReportFile("c:/sample.rpt");
 Datasource ds = eng.getDatabaseTables().getDatasource(0);
 ds.setup("myFirstDSC");
 
 
 

See Also:
DataSourceConfigurationManager, Datasource, Serialized Form

Field Summary
static java.lang.String PROPERTY_ALIASTOKEN
          The property that stores the "aliasToken" flag.
static java.lang.String PROPERTY_CATALOG
          The property that stores the catalog.
static java.lang.String PROPERTY_DATABASE_CLASSNAME
          The property that stores the com.inet.report.database.DataFactory
static java.lang.String PROPERTY_DRIVER_CLASSNAME
          The property that stores the full qualified class name of JDBC Driver.
static java.lang.String PROPERTY_DRIVER_LIBRARY
          The property that stores the JDBC Driver library.
static java.lang.String PROPERTY_ESCAPE_EVERYTHING
          The property that stores the "escapeEverything" flag.
static java.lang.String PROPERTY_IDENTIFIER_QUOTE_STRING
          The property that stores the "identifierQuoteString" flag.
static java.lang.String PROPERTY_INITSQL
          The property defining the sql statement which should be executed after the JDBC connection has been established.
static java.lang.String PROPERTY_PASSWORD
          The property that stores the user password.
static java.lang.String PROPERTY_QUOTES_LOWER_CASE
          The property that stores the "quotesLowerCase" flag.
static java.lang.String PROPERTY_SAVE_PASSWORD
          The property that stores the "savePassword" flag.
static java.lang.String PROPERTY_SUPPORTS_ORDERBY
          The property that stores the "supportsOrderBy" flag.
static java.lang.String PROPERTY_SUPPORTS_SQL92
          The property that stores the "supportsSQL92" flag.
static java.lang.String PROPERTY_SUPPORTS_WHERE
          The property that stores the "supportsWhere" flag.
static java.lang.String PROPERTY_URL
          The property that stores the JDBC URL.
static java.lang.String PROPERTY_USER
          The property that stores the user.
static java.lang.String PROPERTY_USE_PARENTHESES_FOR_JOIN
          The property that stores the "supportsParenthesesForJoin" flag.
static java.lang.String PROPERTY_VALIDATION_QUERY
          The property that stored the validation query.
 
Method Summary
static java.lang.String adaptUrl(java.lang.String url, java.util.Properties driverProps)
          Adapts the provided URL by replacing placeholders of format {propertyname} with the value of the regarding property in the provided Properties object.
 void addProperties(java.util.Properties properties)
          Adds all properties by forward to function DataSourceConfiguration.addProperty(String, String).
 void addProperty(java.lang.String key, java.lang.String value)
          Add properties here to configure used JDBC driver.
 java.lang.String checkConnection()
          Deprecated. As of i-net Crystal-Clear 10.0, replaced by validate()
 int compareTo(java.lang.Object o)
          Order this class by name.
 java.lang.String getAliasToken()
          Returns the SQL keyword that is required to define an alias name in a SQL statement.
 java.lang.String getCatalog()
          Returns the set database catalog.
 java.lang.String getConfigurationName()
          Returns the name of this DataSourceConfiguration.
 java.lang.String getDatabaseClassname()
          Returns com.inet.report.database.DataFactory class name or an empty String.
 java.lang.String getDriverClassname()
          Returns the name of the java.sql.Driver that will be used to establish the Connection to database.
 java.lang.String getDriverLibrary()
          Returns the path of the JDBC Driver jar file.
 java.lang.String getIdentifierQuoteString()
          Returns the string used to quote SQL identifiers.
 java.lang.String getPassword()
          Returns the password of the database user used to create database Connection.
 java.util.Properties getProperties()
          Returns all properties stored in this DataSourceConfiguration.
 java.lang.String getProperty(java.lang.String key)
          Returns the value for passed property.
 java.lang.String getUrl()
          Returns the set JDBC url that will be used to create the Connection.
 java.lang.String getUser()
          Returns the set database user.
 java.lang.String getValidationQuery()
          Returns the set SQL validation query which should be used to check if the database connection is valid or not.
 int hashCode()
          
 boolean isLayoutDataSource()
          Returns if this datasource is a source for creating ad hoc reporting layouts.
 boolean isNeedPassword()
          Returns false if the current driver does not need a password.
 boolean isSavePassword()
          Returns if the password should be saved.
 boolean isUseEscapeEverything()
          Returns the value of the flag escapeEverything.
 boolean isUseOrderBy()
          Indicates whether an ORDER BY clause is allowed for the sql statement.
 boolean isUseParenthesiseForJoin()
          Indicates whether parentheses are allowed in FROM clause os the sql statement.
 boolean isUseQuoteLowerCase()
          Indicates whether table names and column names have to be quoted.
 boolean isUseSQL92syntax()
          Indicates whether the SQL statement can contain the join condition in SQL92 syntax or not.
 boolean isUseWhereClause()
          Indicates whether the SQL statement can contain the WHERE clause or not.
 void save(int preferenceScope)
          Saves the settings of this DataSourceConfiguration to the underlying store (XML file).
 void setAliasToken(java.lang.String aliasToken)
          Sets the SQL keyword that will be put between table name and table alias.
 void setCatalog(java.lang.String catalog)
          Sets the database catalog used to create database Connection.
 void setDatabaseClassname(java.lang.String classname)
          Sets the class name of a class extended from com.inet.report.database.DataFactory.
 void setDriverClassname(java.lang.String classname)
          Sets the class name of a java.sql.Driver implementation.
 void setDriverLibrary(java.lang.String libraryPath)
          Set the path to the library files that will be loaded before using the set JDBC Driver.
 void setIdentifierQuoteString(java.lang.String identifierQuoteString)
          Sets the string used to quote SQL identifiers.
 void setPassword(java.lang.String password)
          Sets the password of the database user used to create database Connection.
 void setSavePassword(boolean savePassword)
          Sets whether the passwort should be saved or not.
 void setUrl(java.lang.String url)
          Sets JDBC url that will be used to create the Connection.
 void setUseEscapeEverything(boolean escapeEverything)
          This method is for adapt the sql statement for a specific database.
 void setUseOrderBy(boolean useOrderBy)
          Set here whether the sql statement can have an ORDER BY clause or not.
 void setUseParenthesiseForJoin(boolean useParenthesiseForJoin)
          Set here whether the sql statement can have parentheses in FROM clause or not.
 void setUseQuoteLowerCase(boolean useQuoteLowerCase)
          Set here whether table names and column names have to be quoted.
 void setUseSQL92syntax(boolean useSQL92syntax)
          Set here whether the SQL statement can contain the join condition in SQL92 syntax or not.
 void setUseWhereClause(boolean useWhereClause)
          Indicates whether the SQL statement can contain the WHERE clause or not.
 void setUser(java.lang.String user)
          Sets the database user used to create database Connection.
 void setValidationQuery(java.lang.String validationQuery)
          Sets the SQL query which should be executed to validate the connection defined by this DataSourceConfiguration.
 java.lang.String toString()
          Returns the name of this DataSourceConfiguration.
 void validate()
          Checks if it is possible to get a connection based on this DataSourceConfiguration.
 

Field Detail

PROPERTY_CATALOG

public static final java.lang.String PROPERTY_CATALOG
The property that stores the catalog.

Since:
7.5
See Also:
setCatalog(String), getCatalog(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_USER

public static final java.lang.String PROPERTY_USER
The property that stores the user.

See Also:
setUser(String), getUser(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_PASSWORD

public static final java.lang.String PROPERTY_PASSWORD
The property that stores the user password.

See Also:
setPassword(String), getPassword(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_SAVE_PASSWORD

public static final java.lang.String PROPERTY_SAVE_PASSWORD
The property that stores the "savePassword" flag.

Since:
7.5
See Also:
setSavePassword(boolean), isSavePassword(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_URL

public static final java.lang.String PROPERTY_URL
The property that stores the JDBC URL.

See Also:
setUrl(String), getUrl(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_SUPPORTS_SQL92

public static final java.lang.String PROPERTY_SUPPORTS_SQL92
The property that stores the "supportsSQL92" flag.

See Also:
setUseSQL92syntax(boolean), isUseSQL92syntax(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_SUPPORTS_ORDERBY

public static final java.lang.String PROPERTY_SUPPORTS_ORDERBY
The property that stores the "supportsOrderBy" flag.

See Also:
setUseOrderBy(boolean), isUseOrderBy(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_SUPPORTS_WHERE

public static final java.lang.String PROPERTY_SUPPORTS_WHERE
The property that stores the "supportsWhere" flag.

See Also:
setUseWhereClause(boolean), isUseWhereClause(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_DRIVER_LIBRARY

public static final java.lang.String PROPERTY_DRIVER_LIBRARY
The property that stores the JDBC Driver library.

See Also:
setDriverLibrary(String), getDriverLibrary(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_DRIVER_CLASSNAME

public static final java.lang.String PROPERTY_DRIVER_CLASSNAME
The property that stores the full qualified class name of JDBC Driver.

See Also:
setDriverLibrary(String), getDriverClassname(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_DATABASE_CLASSNAME

public static final java.lang.String PROPERTY_DATABASE_CLASSNAME
The property that stores the com.inet.report.database.DataFactory

See Also:
setDatabaseClassname(String), getDatabaseClassname(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_QUOTES_LOWER_CASE

public static final java.lang.String PROPERTY_QUOTES_LOWER_CASE
The property that stores the "quotesLowerCase" flag.

See Also:
setUseQuoteLowerCase(boolean), isUseQuoteLowerCase(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_USE_PARENTHESES_FOR_JOIN

public static final java.lang.String PROPERTY_USE_PARENTHESES_FOR_JOIN
The property that stores the "supportsParenthesesForJoin" flag.

See Also:
setUseParenthesiseForJoin(boolean), isUseParenthesiseForJoin(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_IDENTIFIER_QUOTE_STRING

public static final java.lang.String PROPERTY_IDENTIFIER_QUOTE_STRING
The property that stores the "identifierQuoteString" flag.

See Also:
setIdentifierQuoteString(String), getIdentifierQuoteString(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_ALIASTOKEN

public static final java.lang.String PROPERTY_ALIASTOKEN
The property that stores the "aliasToken" flag.

See Also:
setAliasToken(String), getAliasToken(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_ESCAPE_EVERYTHING

public static final java.lang.String PROPERTY_ESCAPE_EVERYTHING
The property that stores the "escapeEverything" flag.

See Also:
setAliasToken(String), getAliasToken(), addProperty(String, String), getProperty(String), Constant Field Values

PROPERTY_VALIDATION_QUERY

public static final java.lang.String PROPERTY_VALIDATION_QUERY
The property that stored the validation query.

Since:
7.1
See Also:
setValidationQuery(String), getValidationQuery(), Constant Field Values

PROPERTY_INITSQL

public static final java.lang.String PROPERTY_INITSQL
The property defining the sql statement which should be executed after the JDBC connection has been established. This sql statement can be used to e.g. prepare the connection to use bind variables for Oracle databases.

See Also:
getProperty(String), addProperty(String, String), Constant Field Values
Method Detail

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

addProperty

public void addProperty(java.lang.String key,
                        java.lang.String value)
Add properties here to configure used JDBC driver. Please read the driver manual of the vendor to find out which properties are supported by used driver.

Parameters:
key - the property.
value - the property value.
Throws:
java.lang.NullPointerException - If the property key was null.
java.lang.IllegalArgumentException - If the property key was empty.
See Also:
getProperties(), getProperty(String), addProperties(Properties)

addProperties

public void addProperties(java.util.Properties properties)
Adds all properties by forward to function DataSourceConfiguration.addProperty(String, String).

Parameters:
properties - A Properties object containing all properties which should be set for this DataSourceConfiguration.
See Also:
addProperty(String, String)

isUseOrderBy

public boolean isUseOrderBy()
Indicates whether an ORDER BY clause is allowed for the sql statement.
If false is set, i-net Clear Reports creates a SQL statement without ORDER BY clause. Sorting will be done by i-net Clear Reports itselfs. This flag is relevant if tables and one Datasource is used only.

Returns:
true if the SQL statement can have an ORDER BY clause; otherwise false.
See Also:
setUseOrderBy(boolean)

setUseOrderBy

public void setUseOrderBy(boolean useOrderBy)
Set here whether the sql statement can have an ORDER BY clause or not.
If false is set, i-net Clear Reports creates a SQL statement without ORDER BY clause. Sorting will be done by i-net Clear Reports itselfs. This flag is relevant if tables and one Datasource is used only.

Parameters:
useOrderBy - Whether the sql statement can have an ORDER BY clause or not.
See Also:
isUseOrderBy()

isUseParenthesiseForJoin

public boolean isUseParenthesiseForJoin()
Indicates whether parentheses are allowed in FROM clause os the sql statement.
For example the SAPDB does not support parentheses in JOIN syntax.
This flag is relevant if tables and one Datasource is used only.

Returns:
true if the sql statement can have parentheses in FROM clause; otherwise false.
See Also:
setUseParenthesiseForJoin(boolean)

setUseParenthesiseForJoin

public void setUseParenthesiseForJoin(boolean useParenthesiseForJoin)
Set here whether the sql statement can have parentheses in FROM clause or not.
For example the SAPDB does not support parentheses in JOIN syntax.
This flag is relevant if tables and one Datasource is used only.

Parameters:
useParenthesiseForJoin - Whether the sql statement can have parentheses in FROM clause or not.
See Also:
isUseParenthesiseForJoin()

isUseQuoteLowerCase

public boolean isUseQuoteLowerCase()
Indicates whether table names and column names have to be quoted.
This property can be necessary for Oracle databases for example, if table/column where created with quotes and lower case characters.

Returns:
true if table names and column names have to be quoted; otherwise false.
See Also:
setUseQuoteLowerCase(boolean)

setUseQuoteLowerCase

public void setUseQuoteLowerCase(boolean useQuoteLowerCase)
Set here whether table names and column names have to be quoted.
This property can be necessary for Oracle databases for example, if table/column where created with quotes and lower case characters.

Parameters:
useQuoteLowerCase - Whether table names and column names have to be quoted.
See Also:
isUseParenthesiseForJoin()

isUseSQL92syntax

public boolean isUseSQL92syntax()
Indicates whether the SQL statement can contain the join condition in SQL92 syntax or not.

Returns:
true if the SQL statement can contain the join condition in SQL92 syntax; otherwise false.
See Also:
setUseSQL92syntax(boolean)

setUseSQL92syntax

public void setUseSQL92syntax(boolean useSQL92syntax)
Set here whether the SQL statement can contain the join condition in SQL92 syntax or not.
If set on true, the join is contained in FROM clause, otherwise in WHERE clause.
Note: full outer join is not possible in WHERE clause.

Parameters:
useSQL92syntax - Whether the SQL statement can contain the join condition in SQL92 syntax or not.
See Also:
isUseSQL92syntax()

isUseWhereClause

public boolean isUseWhereClause()
Indicates whether the SQL statement can contain the WHERE clause or not.
If false is set, i-net Clear Reports creates a SQL statement without WHERE clause. Filter data will be done by i-net Clear Reports itselfs. This flag is relevant if tables and one Datasource is used only.

Returns:
true if the SQL statement can contain the WHERE clause; otherwise false.
See Also:
setUseWhereClause(boolean)

setUseWhereClause

public void setUseWhereClause(boolean useWhereClause)
Indicates whether the SQL statement can contain the WHERE clause or not.
If false is set, i-net Clear Reports creates a SQL statement without ORDER BY clause. Filter data will be done by i-net Clear Reports itselfs. This flag is relevant if tables and one Datasource is used only.

Parameters:
useWhereClause - Whether the SQL statement can contain the WHERE clause or not.
See Also:
isUseWhereClause()

getAliasToken

public java.lang.String getAliasToken()
Returns the SQL keyword that is required to define an alias name in a SQL statement.
For some databases a whitespace have to be set between table name and table alias. Other database expect the keyword "AS".

Returns:
String the SQL keyword
See Also:
setAliasToken(String)

setAliasToken

public void setAliasToken(java.lang.String aliasToken)
Sets the SQL keyword that will be put between table name and table alias.
E.g. the database PostgreSql requires the keyword "AS".

Parameters:
aliasToken - the SQL keyword.
See Also:
getAliasToken()

isUseEscapeEverything

public boolean isUseEscapeEverything()
Returns the value of the flag escapeEverything.

Returns:
true if the complete table identifier will enclosed with quotes; otherwise false.
See Also:
setUseEscapeEverything(boolean)

setUseEscapeEverything

public void setUseEscapeEverything(boolean escapeEverything)
This method is for adapt the sql statement for a specific database.
This flag influence the way SQL identifier are written to SQL statement. Per default it is false and should be kept false for most of database.
If the flag is set to true, the complete table identifier will enclosed with quotes.
If the table identifier contains catalog/schema information, the complete expression will enclosed with quotes.
Example - escape everything is true:
the original table identifier is "atable" in catalog "aCatalog".
The resulting expression for the table in the sql statement will be : select ... from "aCatalog.aTable"
note: this syntax is not allowed for most of databases. The only known case setting this flag to true is using i-net FOSITEX driver for csv data files.

Parameters:
escapeEverything - True if the whole table identifier should be quoted false(default) otherwise.
See Also:
isUseEscapeEverything()

getIdentifierQuoteString

public java.lang.String getIdentifierQuoteString()
Returns the string used to quote SQL identifiers.

Returns:
String used to quote SQL identifiers.
See Also:
setIdentifierQuoteString(String)

setIdentifierQuoteString

public void setIdentifierQuoteString(java.lang.String identifierQuoteString)
Sets the string used to quote SQL identifiers.

Parameters:
identifierQuoteString - The string which should be used to quote SQL identifiers. Usually this should be a single or double quote.
See Also:
getIdentifierQuoteString()

getDriverClassname

public java.lang.String getDriverClassname()
Returns the name of the java.sql.Driver that will be used to establish the Connection to database.

Returns:
String the driver class name

getDatabaseClassname

public java.lang.String getDatabaseClassname()
Returns com.inet.report.database.DataFactory class name or an empty String.

Returns:
String DataFactory class name or an empty String.

setDriverClassname

public void setDriverClassname(java.lang.String classname)
Sets the class name of a java.sql.Driver implementation.

Parameters:
classname - The package qualified name of the JDBC Driver class.
See Also:
setDriverLibrary(String)

setDatabaseClassname

public void setDatabaseClassname(java.lang.String classname)
Sets the class name of a class extended from com.inet.report.database.DataFactory. Instead of using a JDBC Connection to fetch data for the report, a com.inet.report.database.DataFactory can be used to set the data via java code directly.

Parameters:
classname - the full qualified classname of a com.inet.report.database.DataFactory class.

getConfigurationName

public java.lang.String getConfigurationName()
Returns the name of this DataSourceConfiguration.

Returns:
String - the name of this DataSourceConfiguration.
See Also:
DataSourceConfiguration(String), DataSourceConfiguration(String, String)

toString

public java.lang.String toString()
Returns the name of this DataSourceConfiguration.

Overrides:
toString in class java.lang.Object
Returns:
String - the name of this DataSourceConfiguration.
See Also:
getConfigurationName()

getUrl

public java.lang.String getUrl()
Returns the set JDBC url that will be used to create the Connection.

Returns:
the set JDBC url that will be used to create the Connection.

setUrl

public void setUrl(java.lang.String url)
Sets JDBC url that will be used to create the Connection.

Parameters:
url - the JDBC url that will be used to create the Connection.

getProperties

public java.util.Properties getProperties()
Returns all properties stored in this DataSourceConfiguration. It contains at least the listed properties below. The configuration name is not listed in the Properties object.

Returns:
all properties stored in this DataSourceConfiguration.

getProperty

public java.lang.String getProperty(java.lang.String key)
Returns the value for passed property.

Parameters:
key - the value for set property.
Returns:
String - The property value or an empty string.

getCatalog

public java.lang.String getCatalog()
Returns the set database catalog.

Returns:
String - the database catalog or an empty String.

setCatalog

public void setCatalog(java.lang.String catalog)
Sets the database catalog used to create database Connection.

Parameters:
catalog - - the database catalog used to create database Connection.

getUser

public java.lang.String getUser()
Returns the set database user.

Returns:
String - the database user or an empty String.

setUser

public void setUser(java.lang.String user)
Sets the database user used to create database Connection.

Parameters:
user - - the database user used to create database Connection.

getPassword

public java.lang.String getPassword()
Returns the password of the database user used to create database Connection.

Returns:
String - the password of the database user used to create database Connection or an empty string.

setPassword

public void setPassword(java.lang.String password)
Sets the password of the database user used to create database Connection.

Parameters:
password - the password of the database user used to create database Connection.

setSavePassword

public void setSavePassword(boolean savePassword)
Sets whether the passwort should be saved or not.

Parameters:
savePassword - true for saving password
See Also:
isSavePassword()

isSavePassword

public boolean isSavePassword()
Returns if the password should be saved.

Returns:
true if the password should be saved
See Also:
setSavePassword(boolean)

isNeedPassword

public boolean isNeedPassword()
Returns false if the current driver does not need a password. If it need a password or we does not know it then it return true.

Returns:
false if nopassword is needed.
Since:
9.2

getDriverLibrary

public java.lang.String getDriverLibrary()
Returns the path of the JDBC Driver jar file.

Returns:
String - the path of the JDBC Driver jar file.

setDriverLibrary

public void setDriverLibrary(java.lang.String libraryPath)
Set the path to the library files that will be loaded before using the set JDBC Driver.

Parameters:
libraryPath - path to the library files which are to be set on the class path prior to using the set JDBC driver.
See Also:
setDriverClassname(String)

save

public void save(int preferenceScope)
          throws java.lang.SecurityException
Saves the settings of this DataSourceConfiguration to the underlying store (XML file). Only if this function was called, changes affects the report execution.

Parameters:
preferenceScope - - Possible values:
  • DataSourceConfigurationManager.SYSTEM_PREFERENCES
  • DataSourceConfigurationManager.USER_PREFERENCES
Throws:
java.lang.SecurityException - if there is no write access to the given Java Preferences

checkConnection

@Deprecated
public java.lang.String checkConnection()
                                 throws java.lang.Throwable
Deprecated. As of i-net Crystal-Clear 10.0, replaced by validate()

Checks if it is possible to get a connection based on this DataSourceConfiguration. Throw an exception if the connection can't be established. The exception includes details of the problem.

Returns:
ever null.
Throws:
java.lang.Throwable - If an error occurred during connection check, it is thrown to be handle by the caller

validate

public void validate()
              throws java.lang.ClassNotFoundException,
                     java.lang.InstantiationException,
                     java.lang.IllegalAccessException,
                     java.sql.SQLException,
                     ReportException
Checks if it is possible to get a connection based on this DataSourceConfiguration. Throw an exception if the connection can't be established. The exception include details of the problem.

Throws:
java.lang.ClassNotFoundException - If the class could not be found in the current class path nor the lib directory of i-net Clear Reports.
java.lang.InstantiationException - if the driver class represents an abstract class, an interface, an array class, a primitive type, or void; or if the class has no nullary constructor; or if the instantiation fails for some other reason.
java.lang.IllegalAccessException - if the driver class or its nullary constructor is not accessible.
java.sql.SQLException - if a database access error occurs
ReportException - If the JDBC URL is not valid for the given driver.
java.lang.ClassCastException - If the database class name is not an instance of com.inet.report.database.DataFactory
Since:
10.0

adaptUrl

public static java.lang.String adaptUrl(java.lang.String url,
                                        java.util.Properties driverProps)
Adapts the provided URL by replacing placeholders of format {propertyname} with the value of the regarding property in the provided Properties object.

Parameters:
url - The URL to adapt.
driverProps - The driver properties to be inserted into the URL.
Returns:
The modified URL.

setValidationQuery

public void setValidationQuery(java.lang.String validationQuery)
Sets the SQL query which should be executed to validate the connection defined by this DataSourceConfiguration. Usually Connection.isClosed() will be called to check if the connection is still valid. In some circumstances it is possible that this returns true although the connection is invalid. (e.g. the network connection to the database is still established but the database server does not accept any further query). In this case the connection can be checked with a simple SQL query. If this query can be executed without any error the connection should be valid.

Parameters:
validationQuery - The SQL query which should be executed for validation of the database connection.
See Also:
getValidationQuery()

getValidationQuery

public java.lang.String getValidationQuery()
Returns the set SQL validation query which should be used to check if the database connection is valid or not.

Returns:
The SQL query used for validation of the database connection.
See Also:
setValidationQuery(String)

compareTo

public int compareTo(java.lang.Object o)
Order this class by name. It uses String.compareTo(String).
Note: this class has a natural ordering that is inconsistent with equals.

Parameters:
o - DatasourceConfiguration to be compared with
Returns:
the value 0 if the passed configuration's name is a string lexicographically equal to this configuration's name; a value less than 0 if the passed configuration's name is a string lexicographically greater than this configuration's name; and a value greater than 0 if the passed configuration's name is a string lexicographically less than this configuration's name.
See Also:
getConfigurationName()

isLayoutDataSource

public boolean isLayoutDataSource()
Returns if this datasource is a source for creating ad hoc reporting layouts.

Returns:
true if it is a datasource for creating ad hoc reporting layouts, false otherwise.

i-net Clear Reports

Copyright © 1999-2015 by i-net software GmbH