0

I am new to springsource and this is my first project. I am reading s flat file and saving it to a MS SQL server 2008 table, but the command below is incorrect. It works on the similar project that I have been using as a model (I copied the components and modified the commands to read my own input file format and my own SQL server table).

The difference between the table that I created for my project and the table from my model, is that my table contains one primary key and one secondary key, as in the source model, the output table has only one primary key. Below is the "bad" insert statement, any help will be greatly appreciated.

String sql = "insert into dbo.IN136_DMV_USED_CAR_SALES (EXT_INF_LOAD_ID, IN136_ID, " + 
                        "DEALER_NUM, " +
                        "VSL_PURCHASE_DATE," +
                        "OWNERSHIP_ISSUED_DATE, " +
                        "LAST_TRANSFER_DATE, " +
                        "ODOMETER_CURRENT_DATE, " +
                        "WORK_DATE, " +
                        "PURCHASE_PRICE, " +
                        "VIN_HIN, " +
                        "CURRENT_LICENSE, " +
                        "REG_OWNER_NAME, " +
                        "REG_OWNER_ADDRESS2, " +
                        "REG_OWNER_ADDRESS3, " +
                        "REG_OWNER_CITY_OR_STATE) values (?, NEWID(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";

Here is the only thing I can see form the console:

counter is=1 IN136DataRecod=boe.eai.provider.dmv.IN136DataRecord@d5c0f9and sql is about to fail INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml] logger.debug DMVErr, e=org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [insert into dbo.IN136_DMV_USED_CAR_SALES (EXT_INF_LOAD_ID, IN136_ID, DEALER_NUM, VSL_PURCHASE_DATE,OWNERSHIP_ISSUED_DATE, LAST_TRANSFER_DATE, ODOMETER_CURRENT_DATE, WORK_DATE, PURCHASE_PRICE, VIN_HIN, CURRENT_LICENSE, REG_OWNER_NAME, REG_OWNER_ADDRESS2, REG_OWNER_ADDRESS3, REG_OWNER_CITY_OR_STATE) values (?, NEWID(), ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; nested exception is java.sql.SQLException: Invalid parameter index 15.

Thanks in advance for your help

gofr1
  • 15,741
  • 11
  • 42
  • 52
Wanda Larangeira
  • 69
  • 1
  • 2
  • 10

1 Answers1

0

I think the problem is in the way you are writing .

insert into dbo.IN136_DMV_USED_CAR_SALES

Try removing the schema name.