MATLAB: Do I receive JdbcOdbcPr​eparedStat​ement.emul​ateExecute​Batch(Unkn​own Source) error in Database Toolbox 3.5.1 (R2009a)

Database Toolboxjdbckeyodbcprimarysecondarysun

I am using the FASTINSERT function in the Database Toolbox to export large data from MATLAB into a table in a database. I get the following error:
??? Java exception occurred:
sun.jdbc.odbc.JdbcOdbcBatchUpdateException: General error
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.emulateExecuteBatch(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeBatchUpdate(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeBatch(Uknown Source)

Best Answer

The error message relates to a conflict of primary (or other secondary) keys in the database, and is not directly caused by the Database Toolbox. These keys can be considered as constraints set up by the database administrator. For example, one primary key in a database of employees would be that each employee name will be unique.
Consult with your database administrator to see if primary keys are set. If so, to resolve this issue, try the following method:
Insert the rows in smaller set to help pinpoint which entry is invoking the error. It is possible that a duplicate entry is being inserted.