create_postgresql_connection
create_postgresql_connection
function has 1 variants:
Description
create_postgresql_connection
creates a new named connection if it does not exist.If connection fails,
create_postgresql_connection
returns error messages as character string. If connection exists, does nothing.This function can be called in any phase of execution, however it is advised to be called in "connection_not_found" trigger or in user login page.
Declaration
char create_postgresql_connection(char connectionName, char instanceName, char userName, char userPassword);
Parameters
char connectionName
- unique name to identify this connection in web sessionchar instanceName
Database instance namechar userName
- database login user namechar userPassword
database login password
Return Value
Nothing if connection has been made successfully. Otherwise, error text as string.
Example
void cb_oracle.logon2oracle() {
char connResult;
connResult = create_oracle_connection('default', :cb_oracle.tnsname, :cb_oracle.user, :cb_oracle.password);
if (connResult is null) then
show_page('oracle.frmx');
else
message('Error occured: ' || connResult);
end if;
}
void cb_postgresql.logon2postgresql() {
char connResult;
connResult = create_postgresql_connection('default', :cb_postgresql.database, :cb_postgresql.user, :cb_postgresql.password);
if (connResult is null) then
show_page('postgresql.frmx');
else
message('Error occured: ' || connResult);
end if;
}
Last updated
Was this helpful?