Kdb+ and MATLAB interaction: WRITE works well, READ problematic

Added kx.jar to javaclasspath (as recommended here).
javaaddpath(‘/home/ALV/Downloads/kx.jar’);

Java connected to the database and managed to write fine.

q=kx(‘localhost’,5000);
exec(q,‘n:1000000;’);
exec(q,‘item:applebananaorangepear;’);
exec(q,‘city:beijingchicagolondonparis;’);
exec(q,‘tab:([]time:asc n?0D0;n?item;amount:n?100;n?city);’);

Now wanted to read back the data (run a query).

d = fetch(q,‘select from tab where item=`banana’);

Got an error back:
Error using kx/fetch (line 64)
Java exception occurred:
c$KException: type
    at c.k(c.java:581)
    at c.k(c.java:590)
    at c.k(c.java:593)

Tried to fix it by compiling jdbc.class to jdbc.jar and addind to the javaclasspath, but that did not help.
javaaddpath(‘/home/ALV/Downloads/jdbc.jar’);

How can I run a query from MATLAB without getting the error?

as a tip, when faced with these problems, remove each column from the result set to try to identify the problem column. e.g.

d = fetch(q,‘select item,amount,city from tab where item=`banana’);

also include the version/release of matlab and kdb+ which you are using. If you happen to identify that the time column is the problem, try changing its type, e.g.

d = fetch(q,‘select time:time$time,item,amount,city from tab where item=banana’);

Hi Charles. Tried your syntax recommendation. Not the output I expected:

**>> d = fetch(q,‘select time:time$time,item,amount,city from tab where item=banana’);
>> d

d =

      time: [249636x1 double]
      item: {249636x1 cell}
    amount: [249636x1 int64]
      city: {249636x1 cell}**

The version issue does not seem good (too much of a specific detail); R2014a, not sure about the Kdb+ version but the latest 32bit from online.

Looks ok to me. Time coming through as a double probably means as a fraction of the day.
See this page for some guidance

http://code.kx.com/wiki/Cookbook/IntegratingWithMatlab

btw, for future reference

The kdb+ version is printed on startup in the startup banner. The important details are the version and release date, e.g. KDB+ 3.3t 2015.02.06