sql:execute

Full name:

org.kuali.maven.plugins:sql-maven-plugin:1.0.10:execute

Description:

Executes SQL against a database.

Attributes:

  • Requires a Maven project to be executed.

Required Parameters

Name Type Since Description
driver String 1.0 Database driver classname.
forceMojoExecution boolean - Setting this parameter to true will force the execution of this mojo, even if it would get skipped usually.
Default value is: false.
url String 1.0-beta-1 Database URL.

Optional Parameters

Name Type Since Description
autocommit boolean 1.0 Set to true to execute none-transactional SQL.
Default value is: false.
delimiter String 1.0 Set the delimiter that separates SQL statements.
Default value is: ;.
delimiterType String 1.2

The delimiter type takes two values - "normal" and "row". Normal means that any occurrence of the delimiter terminate the SQL command whereas with row, only a line containing just the delimiter is recognized as the end of the command.

For example, set this to "go" and delimiterType to "row" for Sybase ASE or MS SQL Server.


Default value is: normal.
driverProperties String 1.0 Additional key=value pairs separated by comma to be passed into JDBC driver.
enableAnonymousPassword boolean 1.4 If enableAnonymousPassword is 'true', and the password provided is blank or equals 'NONE' do not pass the password to the jdbc driver. This is useful for databases like MySQL where the 'root' user is created by default without a password. The jdbc driver succeeds if no password property is passed to it, but fails if a password property is passed to it but equals NULL or the empty string.
Default value is: false.
enableBlockMode boolean 1.1 Deprecated. used delimiterType instead.
enableFiltering boolean 1.4 Set to true if you want to filter the srcFiles using system-, user- and project properties
encoding String 1.1 Encoding to use when reading SQL statements from a file.
Default value is: ${project.build.sourceEncoding}.
escapeProcessing boolean 1.4 Argument to Statement.setEscapeProcessing If you want the driver to use regular SQL syntax then set this to false.
Default value is: true.
executeTrailingSQL boolean 1.7 Set to false to disable executing SQL that appears without a delimiter at the end of a file (is enabled by default for backwards compatibility)
Default value is: true.
fileset Fileset 1.0 File(s) containing SQL statements to load.
keepFormat boolean 1.1 Keep the format of an SQL block.
Default value is: false.
onError String 1.0 Action to perform if an error is found. Possible values are abort and continue.
Default value is: abort.
orderFile Order 1.1 Set the order in which the SQL files will be executed. Possible values are ASCENDING and DESCENDING and NONE.
Default value is: NONE.
outputDelimiter String 1.4 (no description)
Default value is: ,.
outputFile File 1.3 Dump the SQL exection's output to a file. Default is stdout.
password String 1.0 Database password. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key.
printResultSet boolean 1.3 Print SQL results.
resourceLocations String[] 1.5 List of resources containing SQL statements. This supports Spring-style resource URL's. eg classpath:org/kuali/db.sql
settingsKey String 1.0 Server's id in settings.xml to look up username and password. Defaults to ${url} if not given.
skip boolean 1.0 When true, skip the execution.
Default value is: false.
skipOnConnectionError boolean 1.1 Skip execution when there is an error obtaining a connection. This is a special case to support databases, such as embedded Derby, that can shutdown the database via the URL (i.e. shutdown=true).
Default value is: false.
sqlCommand String 1.0 SQL input commands separated by ${delimiter}.
srcFiles File[] 1.0 List of files containing SQL statements to load.
username String 1.0 Database username. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key.

Parameter Details

autocommit:

Set to true to execute none-transactional SQL.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • Expression: ${autocommit}
  • Default: false

delimiter:

Set the delimiter that separates SQL statements.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • Expression: ${delimiter}
  • Default: ;

delimiterType:

The delimiter type takes two values - "normal" and "row". Normal means that any occurrence of the delimiter terminate the SQL command whereas with row, only a line containing just the delimiter is recognized as the end of the command.

For example, set this to "go" and delimiterType to "row" for Sybase ASE or MS SQL Server.

  • Type: java.lang.String
  • Since: 1.2
  • Required: No
  • Expression: ${delimiterType}
  • Default: normal

driver:

Database driver classname.
  • Type: java.lang.String
  • Since: 1.0
  • Required: Yes
  • Expression: ${driver}

driverProperties:

Additional key=value pairs separated by comma to be passed into JDBC driver.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • Expression: ${driverProperties}

enableAnonymousPassword:

If enableAnonymousPassword is 'true', and the password provided is blank or equals 'NONE' do not pass the password to the jdbc driver. This is useful for databases like MySQL where the 'root' user is created by default without a password. The jdbc driver succeeds if no password property is passed to it, but fails if a password property is passed to it but equals NULL or the empty string.
  • Type: boolean
  • Since: 1.4
  • Required: No
  • Default: false

enableBlockMode:

Deprecated. used delimiterType instead.
When true, the whole SQL content in sqlCommand, srcFiles and fileset are sent directly to JDBC in one SQL statement. This option is for executing database stored procedures/functions.
  • Type: boolean
  • Since: 1.1
  • Required: No
  • Expression: ${enableBlockMode}

enableFiltering:

Set to true if you want to filter the srcFiles using system-, user- and project properties
  • Type: boolean
  • Since: 1.4
  • Required: No

encoding:

Encoding to use when reading SQL statements from a file.
  • Type: java.lang.String
  • Since: 1.1
  • Required: No
  • Expression: ${encoding}
  • Default: ${project.build.sourceEncoding}

escapeProcessing:

Argument to Statement.setEscapeProcessing If you want the driver to use regular SQL syntax then set this to false.
  • Type: boolean
  • Since: 1.4
  • Required: No
  • Expression: ${escapeProcessing}
  • Default: true

executeTrailingSQL:

Set to false to disable executing SQL that appears without a delimiter at the end of a file (is enabled by default for backwards compatibility)
  • Type: boolean
  • Since: 1.7
  • Required: No
  • Expression: ${sql.executeTrailingSQL}
  • Default: true

fileset:

File(s) containing SQL statements to load.
  • Type: org.codehaus.mojo.sql.Fileset
  • Since: 1.0
  • Required: No

forceMojoExecution:

Setting this parameter to true will force the execution of this mojo, even if it would get skipped usually.
  • Type: boolean
  • Required: Yes
  • Expression: ${forceOpenJpaExecution}
  • Default: false

keepFormat:

Keep the format of an SQL block.
  • Type: boolean
  • Since: 1.1
  • Required: No
  • Expression: ${keepFormat}
  • Default: false

onError:

Action to perform if an error is found. Possible values are abort and continue.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • Expression: ${onError}
  • Default: abort

orderFile:

Set the order in which the SQL files will be executed. Possible values are ASCENDING and DESCENDING and NONE.
  • Type: org.codehaus.mojo.sql.Order
  • Since: 1.1
  • Required: No
  • Expression: ${orderFile}
  • Default: NONE

outputDelimiter:

(no description)
  • Type: java.lang.String
  • Since: 1.4
  • Required: No
  • Default: ,

outputFile:

Dump the SQL exection's output to a file. Default is stdout.
  • Type: java.io.File
  • Since: 1.3
  • Required: No

password:

Database password. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • Expression: ${password}

printResultSet:

Print SQL results.
  • Type: boolean
  • Since: 1.3
  • Required: No

resourceLocations:

List of resources containing SQL statements. This supports Spring-style resource URL's. eg classpath:org/kuali/db.sql
  • Type: java.lang.String[]
  • Since: 1.5
  • Required: No

settingsKey:

Server's id in settings.xml to look up username and password. Defaults to ${url} if not given.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • Expression: ${settingsKey}

skip:

When true, skip the execution.
  • Type: boolean
  • Since: 1.0
  • Required: No
  • Default: false

skipOnConnectionError:

Skip execution when there is an error obtaining a connection. This is a special case to support databases, such as embedded Derby, that can shutdown the database via the URL (i.e. shutdown=true).
  • Type: boolean
  • Since: 1.1
  • Required: No
  • Expression: ${skipOnConnectionError}
  • Default: false

sqlCommand:

SQL input commands separated by ${delimiter}.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • Expression: ${sqlCommand}

srcFiles:

List of files containing SQL statements to load.
  • Type: java.io.File[]
  • Since: 1.0
  • Required: No

url:

Database URL.
  • Type: java.lang.String
  • Since: 1.0-beta-1
  • Required: Yes
  • Expression: ${url}

username:

Database username. If not given, it will be looked up through settings.xml's server with ${settingsKey} as key.
  • Type: java.lang.String
  • Since: 1.0
  • Required: No
  • Expression: ${username}