Creating Data Source Dynamically

Overview

Data source can be predefined/modified/deleted in AEM (refer to the section called “Data Source” in PowerServer Configuration Guide for .NET for details), or dynamically created/modified/deleted via appeondconfigdatasource object in Appeon Workarounds PBLs. But unlike creating data source in AEM, you could only dynamically create data source for the following database types: Microsoft SQL Server, Teradata, MySQL, SAP ASE, and PostgreSQL (data sources for Oracle, IBM Informix, SAP HANA, and SAP SQL Anywhere cannot be created via appeondconfigdatasource object; they can only be created in AEM).

Note that you can only call appeondconfigdatasource object to dynamically create data source on the PowerServer for .NET version (not J2EE version).

appeondconfigdatasource

of_adddatasource function

Description

Create a data source with the specified parameters.

Syntax

of_adddatasource ( eon_str_connection astr_connection )

Argument

Description

astr_connection

The parameters for the data source. Refer to eon_str_connection structure for the parameter list.

Return value

Integer

0 - Success.

-1 - The parameters are incorrect. Failed to create the data source.

1 - The data source name already exists.

2 - The database type is not supported.

3 - The database connection failed.

of_deletedatasource function

Description

Delete the specified data source.

Syntax

of_deletedatasource ( string as_datasourcename ) returns integer

Argument

Description

as_datasourcename

The name of the data source to be deleted.

Return value

Integer

0 - Success.

-1 - The parameters are incorrect. Failed to delete the data source.

1 - The data source name does not exist. Failed to delete the data source.

of_editdatasource function

Description

Modify the parameters of the specified data source.

Syntax

of_editdatasource ( eon_str_connection astr_connection )

Argument

Description

astr_connection

The parameters of the specified data source. Refer to eon_str_connection structure for the parameter list.

Return value

Integer

0 - Success.

-1 - The parameters are incorrect. Failed to modify the data source.

1 - The data source name does not exist.

2 - The database type is not supported.

3 - The database connection failed.

eon_str_connection structure

Description

Struct.

The parameters of the data source to be created/modified.

Type

Variable Name

Description

string

s_dbtype

The database type of the data source. Supported values are: sqlserver, teradata, mysql, ase, postgresql, db2

string

s_datasourcename

The name of the data source to be created/modified.

string

s_server

The machine name or IP address of the database server.

string

s_port

The port number of the database server.

string

s_database

The database name.

string

s_username

The user name of the database.

string

s_password

The password of the database.

string

s_maxpool

The maximum number of connections PowerServer opens and pools on startup.

string

s_minpool

The minimum number of connections PowerServer opens and pools on startup.

string

s_pooling

Whether to use the connection pool. Supported values are: true, false.

string

s_connectiontimeout

The timeout period (in seconds) for the connection.

string

s_commandtimeout

The timeout period (in seconds) for the commands.

string

s_usedynamicconn

Whether to enable dynamic database connection. Supported values are: true, false.