Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Database Connector Data Types Reference

This topic includes information about database input parameters and defining custom data types you can use when connected to a particular connection provider.

Forcing Parameter types

Although uncommon, at some point you might need to force the underlying JDBC driver to coerce an input parameter to an specific type. For example, if your JDBC driver cannot determine the type of the input, or a parameter is of a custom type, you might need to apply force by specifing the type of each input parameter:


         
      
1
2
3
4
5
6
7
<db:bulk-insert queryTimeout="0" queryTimeoutUnit="SECONDS">
     <db:sql>INSERT INTO PLANET(POSITION, NAME) VALUES (:position, :name)</db:sql>
     <db:parameter-types>
         <db:parameter-type key="name" type="VARCHAR" />
         <db:parameter-type key="position" type="INTEGER" />
     </db:parameter-types>
 </db:bulk-insert>

Defining Custom Data Types

The Database Connector Technical Reference describes exclusive and common parameters for each connection provider, such as Derby and Oracle. A child element of the connection provider element defines custom data types you can use when connected to a particular provider. For example:


         
      
1
2
3
4
5
6
7
8
<db:config name="dbConfig">
   <db:derby-connection url="jdbc:derby:muleEmbeddedDB;create=true">
       <db:custom-data-types>
           <!-- Derby uses JAVA_OBJECT for UDT-->
           <db:custom-data-type typeName="CONTACT_DETAILS" id="2000"/>
       </db:custom-data-types>
   </db:derby-connection>
</db:config>