Configure Database Access
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>
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.
<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:
- Download the latest JDBC driver from http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html.
- Copy the JDBC .jar file to data loader install folder/java/bin.