Connecting to data sources : Connecting to data sources : Connecting to custom data sources : Specifying connection types
 
Specifying connection types
iHub installation provides an example of a datasources.xml configuration file that specifies a MySQL Enterprise connection type as an example. The datasources.xml file specifies the JDBC connection type as shown in Listing 14‑2.
Listing 14‑2 Specifying JDBC connection types in datasources.xml
<DataSourceConfig>
 
<DataSourceHosts>
</DataSourceHosts>
 
<ConnectionTypes>
<
-- Example: MySQL Enterprise connection type
(requires MySQL driver) -->
<ConnectionType Name="MySQL_41">
<JDBCDriver DriverName="com.mysql.jdbc.Driver">
<ConnectionString>
jdbc:mysql://%server%:%port%/%database%?
</ConnectionString>
<ConnectionProperties>
<Property Name="user">%username%</Property>
<Property Name="password">%password%</Property>
</ConnectionProperties>
<LibraryPath>
<
-- Fill in JAR location below -->
<Location></Location>
</LibraryPath>
</JDBCDriver>
<ConnectionParams>
<ConnectionParam Name="server"
Display="Server"
Type="string"
ValueIsCaseSensitive="false"/>
<ConnectionParam Name="database"
Display="Database"
Type="string"
ValueIsCaseSensitive="false"/>
<ConnectionParam Name="username"
Display="User name"
Type="string"/>
<ConnectionParam Name="password"
Display="Password"
Type="masked"/>
<ConnectionParam Name="port"
Display="Port"
Type="integer"
Optional="true"
DefaultValue="3306"/>
</ConnectionParams>
</ConnectionType>
 
</ConnectionTypes>
 
<DatabaseTypes> <
-- Example: MySQL data base type -->
<
--
<DatabaseType Name="MySQL_41" DisplayName="MySQL 4.1"
ConnectionType="MySQL_41"
DataSourceMapper="BaseMySQLMapper"
DataSourceMapping="MySQL"/>
-->
</DatabaseTypes>
</DataSourceConfig>
Specify the location of the JDBC driver in <Library Path>, as shown in Listing 14‑2. Place the driver classes or Java archive (.jar) files accessing JDBC data sources in the /drivers directory, as described earlier in this document.