Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!

COPY statement from MATLAB giving error

I'm trying to run COPY statement from MATLAB in my local machine to load data into Vertica database on the server. I keep getting error: 

 

'[Vertica][JDBC](11300) A ResultSet was expected but not generated from query "COPY Schema.tableName (FK_CUSTOMER_ID,FK_RUN_START_DATE_ID,FK_RUN_END_DATE_ID,FK_TRAVEL_ID,FK_ORIGIN_ID,FK_DEST_ID,FK_SEGMENT_ID, SEGMENT_PERCENTAGE,LAST_UPDATED) FROM LOCAL ''D:\MATLAB\Testing_env\test2.dat''  DELIMITER '','' ;". Query not executed. '

 

This is the code I'm executing: -

 

 

COPY Schema.tableName (FK_CUSTOMER_ID,FK_RUN_START_DATE_ID,FK_RUN_END_DATE_ID,FK_TRAVEL_ID,FK_ORIGIN_ID,FK_DEST_ID,FK_SEGMENT_ID, SEGMENT_PERCENTAGE,LAST_UPDATED) FROM LOCAL 'D:\MATLAB\Testing_env\test2.dat'  DELIMITER ',' ;

 I'm using a function exec(conn,sqlstmnt); in MATLAB which executes the sqlstmnt using the connection settings handle in conn. There is no problem with the connection since I have tried other queries with the same connection.

After Contacting the MATLAB support, they told me because the error says that exec(conn,sqlstmnt) is expecting a result set after the execution and in this case there is nothing to return, the error is generated. So they suggested anothere approach as below which does not expect any thing in return.

s = conn.Handle.createStatement;
s.executeUpdate(sqlstmnt);

But when I tried this method, I get another error :-

 

Error using get
The name 'createStatement' is not an accessible property for an instance of class
'com.vertica.jdbc.VerticaConnectionImpl'.

Error in database/subsref (line 16)
B = get(A,S(idx).subs);

Error in Testing_COPY (line 51)
s = conn.Handle.createStatement;

 

Any help is greatly appreciated. 

Comments

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file

Can't find what you're looking for? Search the Vertica Documentation, Knowledge Base, or Blog for more information.