DBDataSourceServer
Overview
DBDataSourceServer
provides runtime access to a database server within Servoy applications, accessible via datasources.db.<server_name>
. This object enables interaction with database servers, including the ability to define client-specific connections, retrieve server names, and access tables within the server. For further details on configuring connections, refer to the JSConnectionDefinition documentation.
Methods Summarized
Define a client connection for this server, you can configure the Database Server to create connections for current client using properties of this JSConnectionDefinition.
Get the server where this server is a data model clone from.
Methods Detailed
defineClientConnection()
Define a client connection for this server, you can configure the Database Server to create connections for current client using properties of this JSConnectionDefinition. All interaction with the database will go over a connection coming from a specific client pool with that is created for this client. Things like username, password or connection properties can be adjusted.
Returns: JSConnectionDefinition DBDataSourceServer server
Sample
var conncetionDefinition = datasources.db.example_data.defineClientConnection().setProperty('key', 'value').create();
getDataModelCloneFrom()
Get the server where this server is a data model clone from.
Returns: DBDataSourceServer DBDataSourceServer server
Sample
datasources.db.example_data.getDataModelCloneFrom().getServerName()
getServerName()
Get the server name.
Returns: String String server name
Sample
datasources.db.example_data.getServerName() // returns 'example_data'
getTableNames()
Returns an array with the names of all tables of this server.
Returns: Array String[] server table names;
Sample
datasources.db.example_data.getTableNames()
Last updated
Was this helpful?