Can I use FASTINSERT statement in MATLAB to insert a complex number into my database using Database Toolbox?
1 view (last 30 days)
Show older comments
I generate a set of complex numbers in MATLAB which I would like to add to my database. When I try inserting into the database using the FASTINSERT command, I receive the following error message:
Java exception occurred:
java.lang.AbstractMethodError: com.microsoft.sqlserver.jdbc.Parameter.setValue(Lcom/microsoft/sqlserver/jdbc/JDBCType;Ljava/lang/Object;Lcom/microsoft/sqlserver/jdbc/JavaType;Lcom/microsoft/sqlserver/jdbc/StreamSetterArgs;Ljava/util/Calendar;Ljava/lang/Integer;Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;)V
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:709)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setTimestamp(SQLServerPreparedStatement.java:1062)
Java exception occurred:
java.lang.AbstractMethodError: com.microsoft.sqlserver.jdbc.Parameter.setValue(Lcom/microsoft/sqlserver/jdbc/JDBCType;Ljava/lang/Object;Lcom/microsoft/sqlserver/jdbc/JavaType;Lcom/microsoft/sqlserver/jdbc/StreamSetterArgs;Ljava/util/Calendar;Ljava/lang/Integer;Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;)V
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:709)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setTimestamp(SQLServerPreparedStatement.java:1062)
Error using database/fastinsert (line 243)
Java exception occurred:
java.lang.AbstractMethodError:
com.microsoft.sqlserver.jdbc.Parameter.setValue(Lcom/microsoft/sqlserver/jdbc/JDBCType;Ljava/lang/Object;Lcom/microsoft/sqlserver/jdbc/JavaType;Lcom/microsoft/sqlserver/jdbc/StreamSetterArgs;Ljava/util/Calendar;Ljava/lang/Integer;Lcom/microsoft/sqlserver/jdbc/SQLServerConnection;)V
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setValue(SQLServerPreparedStatement.java:709)
at
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.setTimestamp(SQLServerPreparedStatement.java:1062)
Accepted Answer
MathWorks Support Team
on 29 Nov 2012
Complex number in MATLAB is represented as a 2-tuple number. There is no specific datatype equivalent in database.
However, as a workaround, make the database column datatype as CHAR and insert character equivalent of the complex number by using:
>> charvariable = num2str(complex variable)
Insert this char variable into the database.
0 Comments
More Answers (0)
See Also
Categories
Find more on Database Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!