Configure Database Access

When you run Data Loader in batch mode from the command line, use \samples\conf\database-conf.xml to configure database access objects, which you use to extract data directly from a database.

The Data Loader command-line interface is supported for Windows only.

Note

DatabaseConfig Bean

The top-level database configuration object is the DatabaseConfig bean, which has these properties.

  • sqlConfig—The SQL configuration bean for the data access object that interacts with a database.
  • dataSource—The bean that acts as database driver and authenticator. It must refer to an implementation of javax.sql.DataSource such as org.apache.commons.dbcp.BasicDataSource.

This code is an example of a DatabaseConfig bean:

<bean id="AccountInsert"
    class="com.salesforce.dataloader.dao.database.DatabaseConfig"
    scope="singleton">
    <property name="sqlConfig" ref="accountInsertSql"/>
</bean>

DataSource

The DataSource bean sets the physical information needed for database connections. It contains the following properties:

  • driverClassName—The fully qualified name of the implementation of a JDBC driver.
  • password—The password for logging in to the database.
  • url—The string for physically connecting to the database.
  • username—The username for logging in to the database.

Depending on your implementation, additional information is required. For example, use org.apache.commons.dbcp.BasicDataSource when database connections are pooled.

The following code is an example of a DataSource bean:
<bean id="oracleRepDataSource"
    class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close"
    scope="prototype">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
    <property name="url" value="jdbc:oracle:thin:@myserver.salesforce.com:1521:TEST"/>
    <property name="username" value="test"/>
    <property name="password" value="test"/>
</bean>

Versions of Data Loader from API version 25.0 onwards do not come with an Oracle JDBC driver. Using Data Loader to connect to an Oracle data source without a JDBC driver installed results in a “Cannot load JDBC driver class” error. To add the Oracle JDBC driver to Data Loader: