Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Database Connector Reference

This page summarizes the configuration parameters of the Database Connector.

Transport (schemadoc:page-title not set)

NOTE Note: In Mule 3.7 and newer, selected fields support MEL expressions. For more information, see the Database Connector guide.

Select

Selects data from a database

Table 1. Attributes of <select…​>
Name Type Required Default Description

config-ref

string

no

Defines the configuration parameters for the JDBC connection.

source

string

no

The expression used to obtain the value used to calculate parameters. Default is empty, so parameters are calculated from the payload".

target

string

no

#[payload]

The enricher expression used to enrich the current message with the result of the SQL processing.

transactionalAction

transactionalActionType

no

JOIN_IF_POSSIBLE

Indicates how the message processor will be behave regarding transactions.

streaming

boolean

no

false

Indicates if result sets must be returned as an iterator or as list of maps.

fetchSize

integer

no

Indices how many rows should be fetched from the database when rows are read from a resultSet. This property its required when streaming is true, in that case a default value (10) is used.

maxRows

integer

no

Sets the limit for the maximum number of rows that any ResultSet object generated by this message processor can contain to the given number. If the limit is exceeded, the excess rows are silently dropped.

Table 2. Child Elements of <select…​>
Name Cardinality Description

dynamic-query

0..1

template-query-ref

0..1

in-param

0..*

parameterized-query

0..1

abstractQueryResultSetHandler

0..1

Update

Updates data from a database

Table 3. Attributes of <update…​>
Name Type Required Default Description

config-ref

string

no

Defines the configuration parameters for the JDBC connection.

source

string

no

The expression used to obtain the value used to calculate parameters. Default is empty, so parameters are calculated from the payload".

target

string

no

#[payload]

The enricher expression used to enrich the current message with the result of the SQL processing.

transactionalAction

transactionalActionType

no

JOIN_IF_POSSIBLE

Indicates how the message processor will be behave regarding transactions.

bulkMode

boolean

no

false

Indicates whether or not a bulk update is requested. When true, payload is required to be a collection and a bulk update will be executed for each item in the collection.

Table 4. Child Elements of <update…​>
Name Cardinality Description

dynamic-query

0..1

template-query-ref

0..1

in-param

0..*

parameterized-query

0..1

Delete

Deletes data from a database

Table 5. Attributes of <delete…​>
Name Type Required Default Description

config-ref

string

no

Defines the configuration parameters for the JDBC connection.

source

string

no

The expression used to obtain the value used to calculate parameters. Default is empty, so parameters are calculated from the payload".

target

string

no

#[payload]

The enricher expression used to enrich the current message with the result of the SQL processing.

transactionalAction

transactionalActionType

no

JOIN_IF_POSSIBLE

Indicates how the message processor will be behave regarding transactions.

bulkMode

boolean

no

false

Indicates whether or not a bulk update is requested. When true, payload is required to be a collection and a bulk update will be executed for each item in the collection.

Table 6. Child Elements of <delete…​>
Name Cardinality Description

dynamic-query

0..1

template-query-ref

0..1

in-param

0..*

parameterized-query

0..1

Insert

Inserts data into a database

Table 7. Attributes of <insert…​>
Name Type Required Default Description

config-ref

string

no

Defines the configuration parameters for the JDBC connection.

source

string

no

The expression used to obtain the value used to calculate parameters. Default is empty, so parameters are calculated from the payload".

target

string

no

#[payload]

The enricher expression used to enrich the current message with the result of the SQL processing.

transactionalAction

transactionalActionType

no

JOIN_IF_POSSIBLE

Indicates how the message processor will be behave regarding transactions.

bulkMode

boolean

no

false

Indicates whether or not a bulk update is requested. When true, payload is required to be a collection and a bulk update will be executed for each item in the collection.

autoGeneratedKeys

boolean

no

false

Indicates when auto-generated keys should be made available for retrieval.

autoGeneratedKeysColumnIndexes

string

no

Comma separated list of column indexes that indicates which auto-generated keys should be made available for retrieval.

autoGeneratedKeysColumnNames

string

no

Comma separated list of column names that indicates which auto-generated keys should be made available for retrieval.

Table 8. Child Elements of <insert…​>
Name Cardinality Description

dynamic-query

0..1

template-query-ref

0..1

in-param

0..*

parameterized-query

0..1

Execute ddl

Enables execution of DDL queries against a database

Table 9. Attributes of <execute-ddl…​>
Name Type Required Default Description

config-ref

string

no

Defines the configuration parameters for the JDBC connection.

source

string

no

The expression used to obtain the value used to calculate parameters. Default is empty, so parameters are calculated from the payload".

target

string

no

#[payload]

The enricher expression used to enrich the current message with the result of the SQL processing.

transactionalAction

transactionalActionType

no

JOIN_IF_POSSIBLE

Indicates how the message processor will be behave regarding transactions.

Table 10. Child Elements of <execute-ddl…​>
Name Cardinality Description

dynamic-query

1..1

Bulk execute

Updates data from a database

Table 11. Attributes of <bulk-execute…​>
Name Type Required Default Description

config-ref

string

no

Defines the configuration parameters for the JDBC connection.

source

string

no

The expression used to obtain the value used to calculate parameters. Default is empty, so parameters are calculated from the payload".

target

string

no

#[payload]

The enricher expression used to enrich the current message with the result of the SQL processing.

transactionalAction

transactionalActionType

no

JOIN_IF_POSSIBLE

Indicates how the message processor will be behave regarding transactions.

file

string

no

The location of a file to load. The file can point to a resource on the classpath or on disk.

No Child Elements of <bulk-execute…​>

Stored procedure

Executes a SQL statement in a database

Table 12. Attributes of <stored-procedure…​>
Name Type Required Default Description

config-ref

string

no

Defines the configuration parameters for the JDBC connection.

source

string

no

The expression used to obtain the value used to calculate parameters. Default is empty, so parameters are calculated from the payload".

target

string

no

#[payload]

The enricher expression used to enrich the current message with the result of the SQL processing.

transactionalAction

transactionalActionType

no

JOIN_IF_POSSIBLE

Indicates how the message processor will be behave regarding transactions.

streaming

boolean

no

false

Indicates if result sets must be returned as an iterator or as list of maps.

fetchSize

integer

no

Indices how many rows should be fetched from the database when rows are read from a resultSet. This property its required when streaming is true, in that case a default value (10) is used.

maxRows

integer

no

Sets the limit for the maximum number of rows that any ResultSet object generated by this message processor can contain to the given number. If the limit is exceeded, the excess rows are silently dropped.

autoGeneratedKeys

boolean

no

false

Indicates when auto-generated keys should be made available for retrieval.

autoGeneratedKeysColumnIndexes

string

no

Comma separated list of column indexes that indicates which auto-generated keys should be made available for retrieval.

autoGeneratedKeysColumnNames

string

no

Comma separated list of column names that indicates which auto-generated keys should be made available for retrieval.

Table 13. Child Elements of <stored-procedure…​>
Name Cardinality Description

dynamic-query

0..1

template-query-ref

0..1

in-param

0..*

parameterized-query

0..1

in-param

0..1

out-param

0..1

inout-param

0..1

Template query

Table 14. Attributes of <template-query…​>
Name Type Required Default Description

name

name (no spaces)

yes

Identifies the query so that other elements can reference it.

Table 15. Child Elements of <template-query…​>
Name Cardinality Description

dynamic-query

1..1

parameterized-query

1..1

in-param

0..*

template-query-ref

1..1

in-param

1..*

Connection properties

Allows to specify a list of custom key-value connectionProperties for the config

No Attributes of <connection-properties…​>

Table 16. Child Elements of <connection-properties…​>
Name Cardinality Description

property

1..*

Data types

Allows to specify non standard data types

No Attributes of <data-types…​>

Table 17. Child Elements of <data-types…​>
Name Cardinality Description

data-type

1..*

Pooling profile

Provides a way to configure database connection pooling.

Table 18. Attributes of <pooling-profile…​>
Name Type Required Default Description

maxPoolSize

integer

no

Maximum number of Connections a pool maintains at any given time.

minPoolSize

integer

no

Minimum number of Connections a pool maintains at any given time.

acquireIncrement

integer

no

Determines how many connections at a time tries to acquire when the pool is exhausted.

preparedStatementCacheSize

integer

no

5

Determines how many statements are cached per pooled connection. Defaults to 0, meaning statement caching is disabled.

maxWaitMillis

string

no

The number of milliseconds a client calling getConnection() waits for a Connection to be checked-in or acquired when the pool is exhausted. Zero means wait indefinitely.

No Child Elements of <pooling-profile…​>

Generic Config

Provides a way to define a JDBC configuration for any DB vendor.

Table 19. Attributes of <generic-config…​>
Name Type Required Default Description

name

name (no spaces)

yes

Identifies the database configuration so other elements can reference it.

dataSource-ref

string

no

Reference to a JDBC DataSource object. This object is typically created using Spring. When using XA transactions, an XADataSource object must be provided.

url

string

no

URL used to connect to the database.

useXaTransactions

boolean

no

Indicates whether or not the created datasource has to support XA transactions. Default is false.

driverClassName

string

no

Fully qualified name of the database driver class.

connectionTimeout

int

no

Maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout.

transactionIsolation

enumeration

no

The transaction isolation level to set on the driver when connecting the database.

Table 20. Child Elements of <generic-config…​>
Name Cardinality Description

pooling-profile

0..1

Provides a way to configure database connection pooling.

connection-properties

0..1

Allows to specify a list of custom key-value connectionProperties for the config

data-types

0..1

Allows to specify non standard data types

Derby config

Table 21. Attributes of <derby-config…​>
Name Type Required Default Description

name

name (no spaces)

yes

Identifies the database configuration so other elements can reference it.

dataSource-ref

string

no

Reference to a JDBC DataSource object. This object is typically created using Spring. When using XA transactions, an XADataSource object must be provided.

url

string

no

URL used to connect to the database.

useXaTransactions

boolean

no

Indicates whether or not the created datasource has to support XA transactions. Default is false.

driverClassName

string

no

Fully qualified name of the database driver class.

connectionTimeout

int

no

Maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout.

transactionIsolation

enumeration

no

The transaction isolation level to set on the driver when connecting the database.

user

string

no

The user that is used for authentication against the database.

password

string

no

The password that is used for authentication against the database.

Table 22. Child Elements of <derby-config…​>
Name Cardinality Description

pooling-profile

0..1

Provides a way to configure database connection pooling.

connection-properties

0..1

Allows to specify a list of custom key-value connectionProperties for the config

data-types

0..1

Allows to specify non standard data types

Oracle Config

Table 23. Attributes of <oracle-config…​>
Name Type Required Default Description

name

name (no spaces)

yes

Identifies the database configuration so other elements can reference it.

dataSource-ref

string

no

Reference to a JDBC DataSource object. This object is typically created using Spring. When using XA transactions, an XADataSource object must be provided.

url

string

no

URL used to connect to the database.

useXaTransactions

boolean

no

Indicates whether or not the created datasource has to support XA transactions. Default is false.

driverClassName

string

no

Fully qualified name of the database driver class.

connectionTimeout

int

no

Maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout.

transactionIsolation

enumeration

no

The transaction isolation level to set on the driver when connecting the database.

user

string

yes

The user that is used for authentication against the database.

password

string

yes

The password that is used for authentication against the database.

host

string

no

Allows to configure just the host part of the JDBC URL (and leave the rest of the default JDBC URL untouched).

port

integer

no

Allows to configure just the port part of the JDBC URL (and leave the rest of the default JDBC URL untouched).

instance

string

no

Allows to configure just the instance part of the JDBC URL (and leave the rest of the default JDBC URL untouched).

Table 24. Child Elements of <oracle-config…​>
Name Cardinality Description

pooling-profile

0..1

Provides a way to configure database connection pooling.

connection-properties

0..1

Allows to specify a list of custom key-value connectionProperties for the config

data-types

0..1

Allows to specify non standard data types

MySQL Config

Table 25. Attributes of <mysql-config…​>
Name Type Required Default Description

name

name (no spaces)

yes

Identifies the database configuration so other elements can reference it.

dataSource-ref

string

no

Reference to a JDBC DataSource object. This object is typically created using Spring. When using XA transactions, an XADataSource object must be provided.

url

string

no

URL used to connect to the database.

useXaTransactions

boolean

no

Indicates whether or not the created datasource has to support XA transactions. Default is false.

driverClassName

string

no

Fully qualified name of the database driver class.

connectionTimeout

int

no

Maximum time in seconds that this data source will wait while attempting to connect to a database. A value of zero specifies that the timeout is the default system timeout if there is one; otherwise, it specifies that there is no timeout.

transactionIsolation

enumeration

no

The transaction isolation level to set on the driver when connecting the database.

user

string

no

The user that is used for authentication against the database.

password

string

no

The password that is used for authentication against the database.

database

string

no

The name of the database. Must be configured unless a full JDBC URL is configured.

host

string

no

Allows to configure just the host part of the JDBC URL (and leave the rest of the default JDBC URL untouched).

port

integer

no

Allows to configure just the port part of the JDBC URL (and leave the rest of the default JDBC URL untouched).

Table 26. Child Elements of <mysql-config…​>
Name Cardinality Description

pooling-profile

0..1

Provides a way to configure database connection pooling.

connection-properties

0..1

Allows to specify a list of custom key-value connectionProperties for the config

data-types

0..1

Allows to specify non standard data types

In param

Table 27. Attributes of <in-param…​>
Name Type Required Default Description

name

string

yes

The name for the input parameter

value

string

yes

The value for the parameter

type

ExtendedJdbcDataTypes

no

Parameter type name

No Child Elements of <in-param…​>

Out Param

Table 28. Attributes of <out-param…​>
Name Type Required Default Description

name

string

yes

The name for the output parameter

type

ExtendedJdbcDataTypes

no

Parameter type name

No Child Elements of <out-param…​>

Inout param

Table 29. Attributes of <inout-param…​>
Name Type Required Default Description

name

string

yes

The name for the output parameter

value

string

yes

The value for the parameter

type

ExtendedJdbcDataTypes

no

Parameter type name

No Child Elements of <inout-param…​>

See Also