The Perl DBI module is a simple Perl database interface used to execute queries. The Perl DBI module executes a query through an appropriate database driver (DBD) module.
A DBD module has the required libraries needed to communicate to a database. When you use the Perl DBI module to make a query, it sends the query to the corresponding DBD module to communicate directly to the database.
With the EC-DBI plugin, you can:
-
Execute SQL scripts from SQL files or from the text area in the parameter form.
-
Create backups for your databases.
The plugin executes the SQL code against databases by using the Perl DBI module, which means that you must install the corresponding DBD module. DBD-mysql and DBD-ODBC are installed by default, which means that you can access MYSQL and SQL Server or any preconfigured ODBC connection by default. Additional DBD Modules are required for Oracle, Postgres, and SQLite. Additionally, it can back up databases by calling command-line tools for almost every database type. For example, MySQL uses mysqldump
, SQL Server uses osql
, Oracle uses exp
, and Postgres usespg_dump
.
This plugin can communicate with the following databases:
-
SQL Server (through ODBC) 2008
-
MySQL 5.5
-
Oracle 9.2 or later
-
SQLite 3.7.7
-
Postgres 8.4 or later
Plugin Version 2.0.5.2022041005 Revised on April 13, 2022
Perl DBI links
More information can be found at this website.
Perl DBD links
Perl DBD modules can be found at this website.
Setting up the plugin configuration
For all parameter descriptions below, required parameters are shown in bold italics. |
In the CloudBees CD UI, go to the Home page, open the Main Menu, and click | to open the Plugin Manager.
Plugin configurations are sets of parameters that apply across some or all of the plugin’s procedures. They reduce repetition of common values, create predefined sets of parameters for end users, and securely store credentials where needed. Each configuration is given a unique name that is entered in designated parameters on procedures that use them.
To create a plugin configuration, go to the CloudBees CD "Administration" tab, then to the "Plugins" subtab. On the right side of the line for the specific plugin, click the "Configure" link to open the Configuration page.
Plugin configuration parameters
Parameter | Description |
---|---|
Configuration Name |
Provide a unique name for the configuration. (Required) |
User Name |
Provide the user login ID for your database connection. (Required) |
Password |
Provide the user-specified password. (Required) |
ExecuteQuery
This procedure creates a database connection through the Perl DBI module and a Perl DBD module to execute an SQL statement against the corresponding database.
You can access any database indirectly by using a preconfigured ODBC. |
Additional Perl modules are required for the following databases:
Database | Module name | CPAN reference |
---|---|---|
Oracle |
DBD-Oracle |
|
SQLite |
DBD-SQLite |
|
Postgres |
DBD-Pg |
Parameter | Description |
---|---|
Database engine |
Select the database engine you want to connect to. Available options are: SQLServer, MySql, Oracle, Sqlite, Postgres, or an ODBC connection to any database. (Required) |
Database name |
The name of the database you want to use. (Required) |
Server |
Database server name. (Required) |
Port |
Database port. Common default ports are:
|
Enable transactions |
If checked, this option protects your data in case of errors. |
Display format |
Select a display format. (Required) |
Sql query |
The query to run against the database. |
Sql file |
Absolute path to a SQL script. |
Configuration name |
Name of the configuration that contains the database user and password. (Required) |
Result (output property path) |
Property name used to store the result of queries. |
BackUpDB
Creates a backup for the specified database.
Parameter | Description |
---|---|
Database engine |
Choose the database engine you want to connect to. Available options are: SQLServer, MySql, Oracle, Postgres and Sqlite. (Required) |
Command Line Utility |
Absolute path to a backup command utility. (Required):
|
Database name |
The name of the database to back up. (Required) |
Server |
Database server name. |
Port |
Database port. Some of the default ports are:
|
Configuration name |
Name of the configuration that contains the database user and password. (Required) |
Name of the backup file |
Name of the backup file (without extension). If you leave the field blank, the file name is "backup". |
Destination path |
The path where you want to store your backup file. (Required) |
Examples and use cases
The following example shows how to create a configuration:

The following example shows a list of server configurations:

The following example shows a completed ExecuteQuery parameter form:

The following example shows output for ExecuteQuery:

The following example shows a completed MySql backup parameter form:

The following example shows output for a MySQL backup:

The following example shows a completed Oracle backup parameter form:

The following example shows output for an Oracle backup:

The following example shows a completed SQL Server backup parameter form:

The following example shows output for a SQL Server backup:
