JSConnectionDefinition
Overview
The JSConnectionDefinition
provides a mechanism for creating and managing client-specific database server connections at runtime in the Servoy environment. It is accessed through datasources.db.myserver.defineClientConnection()
and allows configuration of database connections tailored to the current client session.
This class enables setting properties such as username
and password
for authentication and allows additional connection properties to be defined as key-value pairs. These configurations can be dynamically registered to a server, ensuring that all subsequent connections to the database for that client use the specified settings.
Key functionalities include the ability to retrieve or modify connection details like the username, password, and custom properties. The connection definition can be registered with the server using the create
method, or unregistered and destroyed with the destroy
method, ensuring flexibility in managing runtime database interactions.
Methods Summarized
Registers this JSConnectionDefinition to the server with the current configuration.
void
Destoyes this JSConnectonDefintion, this unregisteres this on the server so it will not use this configuration anymore to create connections.
Set a key value pair that is used as a connection property for this connection definition
Methods Detailed
create()
Registers this JSConnectionDefinition to the server with the current configuration. After this call all connections to that database will use the configuration of this definition.
Returns: JSConnectionDefinition The this if it could be created, this will return null if there was a creating this definition (check logs)
destroy()
Destoyes this JSConnectonDefintion, this unregisteres this on the server so it will not use this configuration anymore to create connections.
Returns: void
password()
returns the password that was set by password(string)
Returns: String the password for this connection.
password(password)
Sets the password to use for this client connection.
Parameters
String password ;
Returns: JSConnectionDefinition this
setProperty(key, value)
Set a key value pair that is used as a connection property for this connection definition
Parameters
Returns: JSConnectionDefinition this
username()
returns the username that was set by username(string)
Returns: String the username for this connection.
username(username)
Sets the username to use for this client connection.
Parameters
String username ;
Returns: JSConnectionDefinition this
Last updated
Was this helpful?