views:

39

answers:

1

Hey,

So I am trying to use the database toolbox in matlab to query a database at my research lab, and on one specific computer, the results it returns from the same query changes each time you run the SAME query command.

connPV = database('dbname','username','password');

Images = fetch(handles.connPV,['SELECT i.id, i.image_type_id, i.image_subtype_id, i.series_description, i.image_file_path, i.date_of_image as studydates, ST.subtype_name, i.pretreatment_flag FROM images i JOIN image_subtypes ST on ST.id = i.image_subtype_id WHERE i.patient_id = ' num2str(45) ' AND ST.subtype_name NOT LIKE "T0%" ORDER BY i.date_of_image'])

close(connPV);

Here are the results of executing the SAME lines of code three times:

Images = id: [20x1 double] image_type_id: [20x1 double] image_subtype_id: [20x1 double] series_description: {20x1 cell} image_file_path: {20x1 cell} studydates: {20x1 cell} subtype_name: {20x1 cell} pretreatment_flag: {20x1 cell}

Images = id: [19x1 double] image_type_id: [19x1 double] image_subtype_id: [19x1 double] series_description: {19x1 cell} image_file_path: {19x1 cell} studydates: {19x1 cell} subtype_name: {19x1 cell} pretreatment_flag: {19x1 cell}

Images = id: [5x1 double] image_type_id: [5x1 double] image_subtype_id: [5x1 double] series_description: {5x1 cell} image_file_path: {5x1 cell} studydates: {5x1 cell} subtype_name: {5x1 cell} pretreatment_flag: {5x1 cell}

Each time, it returns a different number of values. However, if I open query browser for mysql and run the command, it works every time.

I want to be clear that this problem is specific to a particular computer. When my script is executed on other computers in the lab, it runs perfectly. The computer it is failing on is Win7 X64, but there are other X64 in the lab; however, this is the only Win7 computer.

I reinstalled matlab, the mysql driver, and the database toolbox, and I tried it on 2009b and 2010a. I am running out of ideas for such a weird error......any ideas??

Thanks!

Tyler

A: 

As you can instantiate java classes in matlab, you might use a mysql jdbc driver to execute your queries. Executed as java standalone application and scripted in matlab allows to further isolate the issue.

zellus
Thanks! I will look into that...
tylerthemiler