+ Start a Discussion

Error connecting to MSSQL Database with Data Loader


I am trying to do an insert into a MS SQL Server 2012 Database with the Data Loader from command line, however, I am greeted with the following error every time I try and do the insert (I have replaced the path to config here):

2015-01-26 14:14:34,954 FATAL [insertAccountIDs] controller.Controller createDao (Controller.java:186) - Error creating data access object
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 55 in XML document from file [<PATH TO CONFIG>\database-conf.xml] is invalid; nested exception is org.xml.sax.SAXParseException: The content of element type "beans" must match "(description?,(import|alias|bean)*)".

This is my database-conf.xml file:
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  <bean id="sqlServerDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
    <property name="url" value="jdbc:sqlserver://localhost;databaseName=testDB;"/>
-<bean id="insertAccountIDs" class="com.salesforce.dataloader.dao.database.DatabaseConfig" singleton="true">
	<property name="sqlConfig" ref="insertAccountIDsSQL"/>
	<property name="dataSource" ref="sqlServerDataSource"/>
<bean id="insertAccountIDsSQL" class="com.salesforce.dataloader.dao.database.SqlConfig" singleton="true">
    <property name="sqlString">
		INSERT INTO dbo.testTable (Id,Name)
        VALUES (@Id@Name@)
    <property name="sqlParams">
        <entry key="Id" value="java.lang.String"/>
		<entry key="Name" value="java.lang.String"/>

I'm trying to do an insert using the Data Loader using the database connection object.

Thanks in advance for your help!
Best Answer chosen by IPFrampton
I have since solved this myself. It was down to the '-' at the start of line 7 which fixed it. I've now got it inserting into the database as expected.