Problems with fastinsert storing binary data in a MS Access database
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am having problems writing binary data into a Microsoft Access 2007 database using fastinsert. So far my code worked well storing an array of 256 bytes in a MS Access 2007 table. I had to increase the array size to 512 bytes and suddenly fastinsert.m throws an exception saying something about invalid precision.
I wrote a small test program that fills the database with increasing array sizes ranging from 1 byte to 10000 bytes because I had no clue why my program did not work anymore. Interestingly once I exceed 511 bytes fastinsert throws an exception. By reaching an array size larger than 8000 bytes everything works as expected without any error.
Because I still was not sure whether the problem is Matlab related or not I tested the database with a small excel vba code using ADO and had no problems at all. The problem could still be database driver depended but any hints are very welcome. Here is the error message (translated) and anything that might help solving my problem.
Thanks Ralf
The array is converted via typecast to an uint8 array of bytes and the database type is set to OLEOBJECT.
Error message:
java.sql.SQLException: [Microsoft][ODBC-Treiber für Microsoft Access]Ungültiger Genauigkeitswert. (translated: invalid precision)
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source) at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBinary(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setBinary(Unknown Source) at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setBytes(Unknown Source)
Exception occurs at:
file: 'C:\Program Files\MATLAB_v7111_r10bSP\toolbox\database\database\@database\fastinsert.m' MATLAB:Java:GenericException
name: 'fastinsert'
line: 210
StatementObject.setBytes(j,tmp) %LONGVARBINARY, VARBINARY
Operatin system and db driver:
Windows 7
'sun.jdbc.odbc.JdbcOdbcDriver'
'jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)'
Access ODBC Driver DatabaseProductName: 'ACCESS'
DatabaseProductVersion: '12.00.0000'
DriverName: 'JDBC-ODBC Bridge (ACEODBC.DLL)'
DriverVersion: '2.0001 (Microsoft Office 2007 Access database engine)'
Matlab Database Toolbox 3.8
0 Kommentare
Antworten (1)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!