Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ODBC broken on 64-bit machine -> fastinsert() keeps breaking

1 view
Skip to first unread message

reza

unread,
Sep 27, 2009, 3:10:45 AM9/27/09
to
The following procedure breaks fastinsert() on 32bit and the 64bit
matlab R2008b, running on 64bit XP machine.

First, create a table named tblTest on the SQL server with one field,
named 'test' of type nvarchar(50)
Then run the following on matlab:

DBName = 'YourDBName';
DBServer = 'YourSQLServerName';
conStr = sprintf('jdbc:odbc:Driver={SQL Server};Server=%s;Database=
%s;Trusted_Connection=Yes;Integrated Security=SSPI', DBServer,
DBName);
conn = database('','','','sun.jdbc.odbc.JdbcOdbcDriver',conStr);
fastinsert(conn, 'tblTest', {'test'}, {'one'; ''});

On a 64bit windows machine this will produce the following error:

java.sql.SQLException: SQL Exception : Unknown SQL Type for
PreparedStatement.setObject (SQL Type=-9
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setObject(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.emulateExecuteBatch
(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeBatchUpdate(Unknown
Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeBatch(Unknown Source)

Oddly enough swaping the entries (last argument of fastinsert) does
not produce an error. So the following works:
fastinsert(conn, 'tblTest', {'test'}, {''; 'one'});


=========

Microsoft changed their ODBC sql header files when they released 64
bit windows so some of the ODBC APIs use a new SQLULEN which is 64
bits where it was 32 bits before. My guess is that this is causing the
problem.

Can anyone reproduce this on a 64bit machine? Vista? Matlab 2009a or
b?

Anyone has a clue for a workaround?

thanks.

/reza

0 new messages