SQL Connection to database established!
Connection Failed! Check output console
Column 'our_data' not found., 0
I'm pretty sure it's because JSON_KEYS(our_data) does not return a String Object!
I'm thinking I've got some parsing to do. But what return type does the select with JSON_KEYS return? And how does one parse an JSON OBJECT from a MySQL DB?
Is there a sassy myRs.getJSONTYPETHING("our_data") that returns the correct object? Do I have to cast the returned value? A million questions?
This completely new to me and I'm just testing whether it's a good idea to include JSON OBJECTS in a MySQL DB.
Ideas? Thoughts? Solutions? Directions? Bad Idea?!
Mike Parish wrote:mysql> select JSON_KEYS(our_data) from test1;
| JSON_KEYS(our_data) |
| ["cars"] |
1 row in set (0.00 sec)
It fails using Java.
It is failing because in your code, you are specifying a column name of our_data, but the result is using a column name of JSON_KEYS(our_data) Three possible fixes:
- change your code to specify column name of JSON_KEYS(our_data): myRs.getString("JSON_KEYS(our_data)") - change your code you specify a column number rather than name: myRs.getString(1) - change your query to return a column name of our_data: select JSON_KEYS(our_data) AS our_data from test1;
posted 2 months ago
So, following your advise:
Doc is: ["cars"] <- exactly what I see from the command line.
Once you see it, it makes so much sense. I think it's time to practise select/insert/delete/update commands in MySQL.