Error Using Mysql In Mathematica

0

I'm using Mathematica, and accessing mysql through mysql (Connector/J). When I try to update a field in my table using WHERE statement, all the rows get updated

SQLUpdate[conn2, "Table", {"pos"}, {"Value1"}, Equal[SQLColumn["word"], "Value2"]]

SQLSelect[conn2, "Recipe.OptOutWordInIngredient"]

I thought it had to do with not using SQLStringMatchQ.
However, when I use SQLStringMatchQ

SQLSelect[conn2, "Table", SQLStringMatchQ[DatabaseLink`SQLColumn["word"], "value"]]

I get the following error:

The value SQLStringMatchQ[acid ,value] cannot be converted to a value in an SQL statement.*

Any help will be appreciated

user3825890

Posted 2015-02-18T15:50:24.397

Reputation: 21

Welcome to Mathematica.SE! I suggest the following:

  1. As you receive help, try to give it too, by answering questions in your area of expertise.
  2. Read the [faq]!
  3. When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge.

Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign!

– None – 2015-02-18T15:58:15.007

1Not an answer to your question, but a tip -- I use Mathematica and MySQL together every day, and I use SQLExecute[] rather than SQLUpdate[] or SQLSelect[]. This way I can test the SQL directly in the mySQL workbench and make sure it's doing what I want before I put in in Mathematica. – Michael Stern – 2016-04-15T21:21:40.987

@MichaelStern I do the same. I was/am very interested to go even further and systematically apply SQL to data massaging and retrieval tasks within Mathematica in the same way the R package "sqldf" does.

– Anton Antonov – 2016-05-15T14:42:18.723

Answers

1

Both these methods of updating work and produce the same results.

SQLUpdate[conn2, "Table", {"pos"}, {"Value1"},
   Equal[SQLColumn["word"], "Value2"]]

SQLUpdate[conn2, "Table", {"pos"}, {"Value1"},
   SQLStringMatchQ[SQLColumn["word"], "Value2"]]

Chris Degnen

Posted 2015-02-18T15:50:24.397

Reputation: 27 033