I have successfully created a connection to a MySQL database via ODBC through a MATLAB 2023a instance. I am running this on a Mac using iODBC to manage the connection. I realize I'm breaking a rule by not providing version numbers on the database. Please bear with me. I am forgetful and writing this from home while it's still on my mind...
I can run simple queries with sqlread (built into MATLAB), enough to confirm the connection works and MATLAB is "seeing" the database. However, I noticed something strange. The tables in the database I am accessing should contain a mix of data types. Some columns are numeric, some columns are text. This is verifiable outside of MATLAB. But... when I read a table into MATLAB through sqlread, all of the columns that are char type are full of <missing> placeholders. Moreover, if I query the database through MATLAB to tell me about the columns in any given table (SQL code: "SHOW TABLES thetable FROM thedatabase" piped through MATLAB function fetch), the table that returns has <missing> placeholders for the data type of each column that should be char type. The numeric columns look great though, both in the summary table I pulled through fetch and just pulled through sqlread.
What am I missing here? Why aren't the string / char fields showing up correctly? From battling related issues elsewhere, I wonder if it's a ANSI / Unicode conflict, but I don't see a way to account for that when initiating the connection in MATLAB.
The only other clue I have is that in the MySQL workbench environment I am using to manage the database, the char data types are all labeled as text or some variant label involving the root "text". This strikes me as interesting because MATLAB's mysql-related documentation doesn't have a text type, only char (and variations on that root). I am not a MySQL expert by any stretch. I am just using it for convenience for a multimodal signal analysis task... So maybe I'm missing some nuance or using a version of MySQL that outran the current version of MATLAB's MySQL wrapper functions?
Any help appreciated!