How to Deal with a jdbc4array?

1 view (last 30 days)
Peter Brady
Peter Brady on 26 Jul 2015
Hi,
I think my question is similar to: http://au.mathworks.com/matlabcentral/answers/83678-accessing-postgressql-time-interval-data but that comment is not working for me.
Like that post I'm using the Database Toolbox to retreive data from a PostgreSQL database via the Postgre JDBC connector and I can also access the vast majority of the "normal" data returned in the query.
My problem is that I have an array of data, in this case it happens to be a time series of double precision, that is returned as an object of class jdbc4array.
I'm not so good with java and the only way I've figured out to extract the elements is with code something like the following:
curs = exec(conn, query);
curs = fetch(curs);
events = curs.Data;
rainFall = cell2mat(eval(events{1, 21}))
My problem is that while the above commands work and successfully extract the values from the jdbc4array into a MATLAB array that I can then process as normal the "eval" operation is computationally expensive. Can anyone suggest a better method to extract the java array into a MATLAB array. The project I'm working on is looking to run hundreds of thousands of events and my profile results indicate that the eval operation is consuming about 80% of the run time - there has to be a better way.
Thanks in advance.
Peter Brady

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!