Standard DB parameters

All database connections use the following parameters:

  • api – a constant value, such as db.MY_SQL or db.SQL_SERVER,  to define the type of database to connect to.
  • name – the name of the database or ODBC source to connect to.
  • user, password – the user name and password to connect to the data source.  Sometimes these can be left blank, depending on the configuration of the data source.
  • live – an optional boolean parameter which determines whether or not the database action is run live against the database while within the editor.  This can be very useful for development but sometimes we may want to switch this off if the actions modify the database or are slow.

For connection objects the are only required once when using db.connect() to create a connection object. For legacy database functions they must be supplied for every function call. Using the (legacy) dbc module you only need to supply the information once – but “under the covers” it just makes the legacy function calls for you.

Most database functions use other parameters in addition to the ones listed above, see db – interacting with databases.

Here is database specific connection information on some of the common databases you can connect to

Here is an example using a connection object that supplies the parameters listed above:

If you are connecting to a remote MySQL database, you specify the remote host as part of the name parameter. See Connecting to a remote MySQL database for details.

The  db.tables{} function requires the following parameters:

  • vmd: the VMD file to be parsed
  • data: the name of a message definition in the VMD file

For more information on db.tables{}, see Inserting using db.tables{} and conn:merge{}.

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.