Home | Table of Contents | JNDI DB DataSource | CloverETL 4.6.1
--- | --- | ---
Prev | Examples of DB Connection Configuration | Next

## JNDI DB DataSource

CloverETL Server can connect to a database using JNDI DataSource, which is configured in an application server or container. However, there are some CloverETL parameters which must be set, otherwise the behavior may be unpredictable:

    datasource.type=JNDI # type of datasource; must be set, because default value is JDBC
    datasource.jndiName=# JNDI location of DB DataSource; default value is java:comp/env/jdbc/clover_server #
    jdbc.dialect=# Set dialect according to DB which DataSource is connected to.
    The same dialect as in the sections above. #

The parameters above may be set in the same way as other parameters (in the properties file or Tomcat context file).

Example of DataSource configuration in Apache Tomcat. The following context resource configuration may be added to the `[Tomcat_home]/conf/server.xml` file to the `<Host>` element.

    <Context path="/clover" >
     	<Resource name="jdbc/clover_server" auth="Container"
     	 	type="javax.sql.DataSource" driverClassName="com.mysql.jdbc.Driver"
     	 	url="jdbc:mysql://127.0.0.1:3306/clover?useUnicode=true&amp;characterEncoding=utf8"
     	 	username="root" password=""
     	 	maxActive="20" maxIdle="10" maxWait="-1"/>
    </Context>

Do not put the code above into `<GlobalNamingResources>` element, since the resource would not be visible by the CloverETL webapp.

| Note
The resource configuration may also be added to the context file `[Tomcat_home]/conf/Catalina/localhost/clover.xml`.

| Note
Special characters typed in the context file have to be specified as XML entities, e.g. ampersand "&" as "&amp;" etc.

| Important
The default jndi pool DBCP in Apache Tomcat does not handle connections in efficient way. With the DBCP jndi pool, low performance can be seen if DBOutputTable with returning statement is used. Use tomcat-jdbc-pool instead. Just add `factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"` to the definition of the jndi resource. See https://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html

See Chapter 9, List of Properties for list of properties.

| Note
Continue with: Encrypted JNDI or CloverETL Server Activation

Prev | Up | Next
Postgre SQL | Home | Table of Contents | Encrypted JNDI