Run SQL file

Goal

This extension will execute SQL script on the database.
You can supply one file per base type.

Packaging task configuration

<extension name="com.axemble.vdoc.update.RunSQLExtension" critical="true">
	<param name="sql" value="FILE_NAME"/>
</extension>
Parameter Mandatory Default value Description
sql true The name of files containing the sql script without base type and extension

Sql Files

Naming convention

Use the format FILE_NAME(_BASE_TYPE).sql

  • FILE_NAME : Your file name
  • _BASE_TYPE : optional base type
    • _MS for Microsoft SQL server database
    • _MY for MySQL database
    • _ORACLE for Oracle database

Folder

Place your file(s) in src/main/custom/script

Examples

  • Custom script on each database
    • parameter : <param name="sql" value="test"/>
    • Microsoft SQL file : src/main/custom/script/test_MS.sql
    • MySQL file : src/main/custom/script/test_MY.sql
    • ORACLE file : src/main/custom/script/test_ORACLE.sql
  • Custom script only for Microsoft SQL database
    • parameter : <param name="sql" value="test"/>
    • MySQL and ORACLE file : src/main/custom/script/test.sql
    • Microsoft SQL file : src/main/custom/script/test_ORACLE.sql
  • Same script on 3 database is not possible because Microsoft SQL require “go” after each statement

Warning

MySQL/ORACLE : Do not forget the semicolon “;” at the end of your statements.
Microsoft SQL : Do not forget the “go” at the end of your statements.

Warning

A compatible file with the database you start is mandatory.