Announcement Announcement Module
No announcement yet.
Bad SQL grammar error on insert statement while using springsource STS Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Bad SQL grammar error on insert statement while using springsource STS

    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. But 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, " +
    "WORK_DATE, " +
    "VIN_HIN, " +
    "REG_OWNER_NAME, " +
    "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.IN136DataRecor [email protected] sql is about to fail
    INFO : org.springframework.beans.factory.xml.XmlBeanDefin itionReader - 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