tag:blogger.com,1999:blog-2959317805805542041.post2967194122767238100..comments2024-03-26T21:47:37.919-07:00Comments on Chuck's Blog: New Release! MySQL Connector/Arduino 1.1 Chuckhttp://www.blogger.com/profile/02410977284521913938noreply@blogger.comBlogger56125tag:blogger.com,1999:blog-2959317805805542041.post-50065422580425363132016-04-12T07:44:12.543-07:002016-04-12T07:44:12.543-07:00Yes, I've not been impressed with the cc3000 l...Yes, I've not been impressed with the cc3000 library. I never understood why they wrote it so differently from the Arduino libraries. <br /><br />I invite you to share your changes with me so that I can use it as input to making the connector work with the cc3000 library. You can contact me at:<br /><br />d r c h a r l e s b e l l at g m a i l dot c o mChuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-42564533520529437002016-04-12T07:42:03.808-07:002016-04-12T07:42:03.808-07:00Yes, it is uptodate. I do not see anything wrong w...Yes, it is uptodate. I do not see anything wrong with your sketch. Can you post the CREATE TABLE statement for the capstone.actionbitlog table? <br /><br />If you want to conduct our conversation via email, you can reply to:<br /><br />d r c h a r l e s b e l l at g m a i l dot c o mChuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-91411520487995308762016-04-11T20:17:51.635-07:002016-04-11T20:17:51.635-07:00So I've noticed my "fix" works with ...So I've noticed my "fix" works with my Due but not with my Uno - this is a Due project so I'm ok with that for now. I'll also note all I'm doing is inserting data.Jeff Thompsonhttps://www.blogger.com/profile/01706509419082549348noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-3490157177820761832016-04-10T23:39:43.581-07:002016-04-10T23:39:43.581-07:00So I'm going through this same thing, The issu...So I'm going through this same thing, The issue is with the cc3000 libraries in from what I can tell two places: <br />-Adafruit_CC3000_Client::connect <br /> reverses the IP address as IPAddress doesn't return what the address as Integer in the same way the cc3000 library expects<br />-Adafruit_CC3000_Client::available <br /> does not return byte received, but what it had buffered so far or just 1 if nothing is buffered but data is available)<br /><br />Frankly the cc3000 library is pretty sloppy... I've hacked it working but nothing clean enough to really be a fix. If I get time I'll fix it properly and do a pull request on that library.Jeff Thompsonhttps://www.blogger.com/profile/01706509419082549348noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-77187705821367743352016-04-06T17:13:47.046-07:002016-04-06T17:13:47.046-07:00Examples of a few rows from the table would be
(1...Examples of a few rows from the table would be<br /><br />(1,1,'2016-04-06 10:00:45',1), (1,0,'2016-04-06 10:01:30',1)<br /><br />Is the Wifi101 example sketch up to date?Anonymoushttps://www.blogger.com/profile/15500486741393587534noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-2224791350695495352016-04-06T06:34:58.510-07:002016-04-06T06:34:58.510-07:00Ok, good. Can you perhaps list a few rows from tha...Ok, good. Can you perhaps list a few rows from that table so I can check the dynamic cursor code?Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-88521914181139765272016-04-05T10:32:40.999-07:002016-04-05T10:32:40.999-07:00Using the "2) Demonstrating using a local, gl...Using the "2) Demonstrating using a local, global cursor." method I am able to read the correct value each loop. I use the value to control an LED on the board (going to control servo motor next) When I change the value on the server it takes about 2 seconds to turn on/off the LED on the board. Hope this info helps I'm glad to be making some progressAnonymoushttps://www.blogger.com/profile/15500486741393587534noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-61372363584975262642016-04-05T10:32:17.257-07:002016-04-05T10:32:17.257-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/15500486741393587534noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-14492124870825408902016-04-05T10:00:55.516-07:002016-04-05T10:00:55.516-07:00Add a print to print out the raw value inside the ...Add a print to print out the raw value inside the row loop.Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-80742796948233925532016-04-05T09:59:40.451-07:002016-04-05T09:59:40.451-07:00What does that select give you in the MySQL client...What does that select give you in the MySQL client?Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-27993641322108626182016-04-05T09:31:54.354-07:002016-04-05T09:31:54.354-07:00I created my own MySQL on my laptop and was able t...I created my own MySQL on my laptop and was able to successfully connect using the ethernet shield and use the examples. <br /><br />I am running into trouble when trying to run a select statement from my own table. The value it should be reading (as tested on the server) is 0 stored as int. I have it defaulted to 0 in the program as well.<br /><br />My changed code from the example is the following:<br /><br />char query[] = "select actionType from capstone.actionbitlog where lockID=1 order by actionTime desc limit 1";<br /><br />void loop() {<br /><br /> row_values *row = NULL;<br /> int type = 0;<br /><br /> delay(1000);<br /><br /> Serial.println("1) Reading type from last actionbitlog");<br /> // Initiate the query class instance<br /> MySQL_Cursor *cur_mem = new MySQL_Cursor(&conn);<br /> // Execute the query<br /> cur_mem->execute(query);<br /> // Fetch the columns (required) but we don't use them.<br /> column_names *columns = cur_mem->get_columns();<br /> <br /> // Read the row (we are only expecting the one)<br /> <br /> <br /> do {<br /> row = cur_mem->get_next_row();<br /> if (row != NULL) {<br /> type = int(row->values[0]);<br /> }<br /> } while (row != NULL);<br /> // Deleting the cursor also frees up memory used<br /> delete cur_mem;<br /><br /> // Show the result<br /> Serial.print(" type = ");<br /> Serial.println(type);<br /><br />The result I receive on the serial monitor is:<br /><br />1) Reading type from last actionbitlog<br /> type = 1466<br />1) Reading type from last actionbitlog<br /> type = 1389<br />1) Reading type from last actionbitlog<br /> type = 1481<br />1) Reading type from last actionbitlog<br /> type = 1466<br />1) Reading type from last actionbitlog<br /> type = 1389<br />1) Reading type from last actionbitlog<br /> type = 1481<br />1) Reading type from last actionbitlog<br /> type = 1466<br /><br />Do you have any idea why I might be receiving these strange values in a pattern like this? I can't seem to find any significance to these numbers.<br /><br />Anything helps. <br /><br />Thanks,<br /><br />Tom Anonymoushttps://www.blogger.com/profile/15500486741393587534noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-83949915904994943802016-03-29T15:18:42.747-07:002016-03-29T15:18:42.747-07:00Thanks, will try this and hopefully report back a ...Thanks, will try this and hopefully report back a success. Anonymoushttps://www.blogger.com/profile/15500486741393587534noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-16921824305525564352016-03-29T13:59:52.677-07:002016-03-29T13:59:52.677-07:00I don't know of such, no, but MySQL is very ea...I don't know of such, no, but MySQL is very easy to install! Go take a look at the docs online (dev.mysql.com). If you're working on Windows, there is an installer that allows you to install and configure everything in a few clicks of the mouse. <br /><br />Other than that, I would recommend installing the MySQL client tools at the very least and use the mysql client to connect to the server.<br /><br />e.g.<br /><br />mysql -uXXXX -p -h NNN.NNN.NNN.NNN --port=NNNN<br /><br />If you can do that, the connector should work with the same credentials. Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-48348642759290747712016-03-29T13:53:36.045-07:002016-03-29T13:53:36.045-07:00A hardware specialist at my university advised me ...A hardware specialist at my university advised me that security measures with the database are pretty strict and I won't be able to connect to it via the arduino. To get around this I created a new database on a free service (freemysqlhosting.net) that provides enough memory for my project. I used the IP address and port that I found for the host on phpMyAdmin to attempt the connection along with the provided username and password that logs me in to phpMyAdmin.<br /><br />I am unsure if I need to do anything with the permissions that I am now reading about in the troubleshooting. I assume my user login credentials give me full read/write access? Maybe this free service has security that won't allow a connection or the IP address I found via phpMyAdmin is incorrect?<br /><br />If you know of any online hosting service that has worked with this library in the past that would be awesome to hear as I have never built my own mySQL server from scratchAnonymoushttps://www.blogger.com/profile/15500486741393587534noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-36713977845239574832016-03-29T13:25:53.355-07:002016-03-29T13:25:53.355-07:00You can use the connector to connect to any MySQL ...You can use the connector to connect to any MySQL server. So long as you can get there by IP address (and port), there is no firewall (locally or remotely) blocking said port, and you have proper permissions to connect to the server.<br /><br />Read the reference manual to learn more about how to troubleshoot connections. Hint: try connecting with your PC through a command prompt using the credentials provided by your University IT staff. Engage them until that works. ;)Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-62034298016032500862016-03-29T13:24:25.607-07:002016-03-29T13:24:25.607-07:00Chuck,
I would really like to use this library on...Chuck,<br /><br />I would really like to use this library on a college project I am working on. I am trying to connect to a MySQL server using a WiFi_101 shield, but I also have an Ethernet shield. I have a MySQL database setup through my university's server and a backup database through an online service. I have tried connecting to both using their IP's, but no success. Does this library only work with local MySQL databases hosted on a PC? Sorry if my lingo is not correct. Would love any advice on connecting to a database as I need to get this rolling.Anonymoushttps://www.blogger.com/profile/15500486741393587534noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-84931615233009003832016-03-28T05:59:33.445-07:002016-03-28T05:59:33.445-07:00Ah, yes, that could be a problem. ;)
Your compil...Ah, yes, that could be a problem. ;) <br /><br />Your compilation error is explained in the reference manual. Specifically, you must enable WITH_SELECT in mysql.h to enable the methods for processing result sets (SELECT queries).<br /><br />However, I once again caution against jumping into such an example. Use the connect example sketch until you solve all of your connectivity issues. Otherwise, problems like this will mask the other issues and perhaps lengthen your development time (as well as frustration).Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-92109227966733560472016-03-28T02:21:18.212-07:002016-03-28T02:21:18.212-07:00Oh. How can I get connector working while I don...Oh. How can I get connector working while I don't posses Ethernet shield? My UNO is connected through USB on laptop which connects to local MySQL server.<br /><br />When I try to compile example mysql_reboot, this is what I get:<br /><br />/tmp/arduino_modified_sketch_548558/hello_mysql_reboot.ino: In function 'void loop()':<br />hello_mysql_reboot:47: error: 'class Connector' has no member named 'show_results'<br /> my_conn.show_results();<br /> ^<br />exit status 1<br />'class Connector' has no member named 'show_results'<br /><br />Anonymoushttps://www.blogger.com/profile/18443637180148799832noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-7755064735309005732016-03-27T15:25:47.978-07:002016-03-27T15:25:47.978-07:00I have never tried SLIP. From what I understand of...I have never tried SLIP. From what I understand of the mechanism, it should be possible. But again, you'll be blazing the trail alone. ;) Try it.<br /><br />I highly recommend you get the connector working first. Don't try using SLIP and setting up the connector code together. Get the one working first.Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-64748958204604712262016-03-27T13:54:12.621-07:002016-03-27T13:54:12.621-07:00Hi,
is it possible to use the Connector library wi...Hi,<br />is it possible to use the Connector library with UNO connected to network through SLIP (SerialIP library)?<br />TomažAnonymoushttps://www.blogger.com/profile/18443637180148799832noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-89375895085063141952016-03-21T15:28:23.154-07:002016-03-21T15:28:23.154-07:00"the example select will do it" - fail I..."the example select will do it" - fail I mean.Gerrondhttps://www.blogger.com/profile/17271509683686279043noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-91282076194356409552016-03-21T15:26:38.247-07:002016-03-21T15:26:38.247-07:00Hi
Thanks for prompt reply and indeed for the sof...Hi<br /><br />Thanks for prompt reply and indeed for the software itself.<br /><br />Late at night here so only the easy ones for now.<br /><br />wdt - WatchDogTimer.<br /><br />I haven't tried many ways of making a table inaccessible but certainly stopping MySQLd will do it. The way I first found out was by opening the table to edit structure using Libre Office base from a remote machine. Does it really matter why there is no response?<br /><br />MySQL Workbench says MySQL is 5.5.44-0+deb7u1 compiled for debian-linux-gnu (i686). This MySQL server never fails for any other type of access I have - MySQL, LO base, php mysqli_connect, Python MySQLdb - either locally or remote, from PC or RasPi as may be. <br /><br />As for the sketch - well the example select will do it.....with appropriate user, server, password, etc., changes of course. Failure is more or less random anything from almost immediate to maybe 2 hours, but (in my sketches) it is more likely to fail on a select than an insert, maybe 5:1.<br /><br />I have been using the dynamic cursor (method 2 in select example I think) as static one seems not to compile on ESP8266 (01 or 12). Loads of memory and Serial.println(ESP.getFreeHeap(),DEC); shows it going down through loop() and then being reclaimed.<br /><br />As I understand it (but please believe my ignorance is woeful) the ESP8266 wdt is reset by any delay() (or yield()) allowing the TCP/IP stack to be serviced.<br /><br />I have not tried this stuff on an Arduino either using the ESP8266 as a WiFi adaptor or with another WiFi adaptor (as i don't have one) or ethernet shield (ditto I but will order one tomorrow). I can't do anything for the next 10 days or so. I will check this page as I am able.<br /><br />Thank you for being so positive.Gerrondhttps://www.blogger.com/profile/17271509683686279043noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-79819703064605565502016-03-21T14:22:56.124-07:002016-03-21T14:22:56.124-07:00Hi. I am sorry you're encountering a problem. ...Hi. I am sorry you're encountering a problem. I want to help, but I need more information.<br /><br />But first, some history and limitations of use.<br /><br />The connector is designed to be as lightweight as possible due to the limited memory footprint of the small devices it used on (Arduino). As such, it does not nor can it support the full MySQL protocol with all of the nice timeouts and error analysis, etc. Indeed, implementing even part of this would make using the connector useless on all but the larger (memory) Arduino boards.<br /><br />However, I am always open to ways to improve the connector and it sounds like you've found a case where some extra error handling code could be helpful.<br /><br />It would help me greatly if I had a full accounting of the use case you're working with including a description of how to set it up as well as the versions of the hardware, MySQL, etc. that you're working with.<br /><br />Also, a setup for the precise table access issue is needed. For example, what do you mean by "inaccessible" - permissions changed, table dropped, etc?<br /><br />It may also be helpful to see your sketch to see how you are using the connector. <br /><br />Finally, what does "wdt" mean? <br /><br />Let's work together to make the connector better! :)Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-15520974018539245282016-03-21T14:01:02.383-07:002016-03-21T14:01:02.383-07:00Hi
Same problem using ESP8266 (no Arduino). Fails ...Hi<br />Same problem using ESP8266 (no Arduino). Fails randomly with no wdt. Always fails in cur_mem->execute(query); line. Instant fail at same line can be provoked by making table inaccessible. It would be nice if the thing timed out with error rather than locking the ESP8266.Gerrondhttps://www.blogger.com/profile/17271509683686279043noreply@blogger.comtag:blogger.com,1999:blog-2959317805805542041.post-18593274465915021952016-03-10T11:24:58.192-08:002016-03-10T11:24:58.192-08:00Hi. Do you mean, SSL? If your MySQL server require...Hi. Do you mean, SSL? If your MySQL server requires SSL connections, then, no, you cannot use the connector. The connector does not support SSL connections. This is because it would consume nearly all of the program memory in order to write the SSL portions for the Arduino. <br /><br />If you could post the command(s) you use to connect to MySQL via the command line, I may be able to discern more about what you're trying to do and offer pointers. Chuckhttps://www.blogger.com/profile/02410977284521913938noreply@blogger.com