Page 1 of 1

Possible issue inserting data into sql db

Posted: Tue 17 Jul 2018 2:08 am
by stefanbagnato
Due to a lightning strike nearby, my station was down for 26 days. I just got it set back up today. I had been updating the txt files with data from a nearby station during the outage, however, I realize now that I need to actually insert the data into the monthly file via sql. However, looking at the MXdiags folder, a bunch of entries have been showing up. Specifically, while the db does seem to be updated every minute, I am getting logs such as the below:

2018-07-16 21:58:00.014 Writing log entry for 7/16/2018 9:58:00 PM
2018-07-16 21:58:00.014 Written log entry for 7/16/2018 9:58:00 PM
2018-07-16 21:58:00.014 Writing today.ini, LastUpdateTime = 7/16/2018 9:58:00 PM raindaystart = 19.6 rain counter = 19.6
2018-07-16 21:58:00.029 INSERT IGNORE INTO Monthly (LogDateTime,Temp,Humidity,Dewpoint,Windspeed,Windgust,Windbearing,RainRate,TodayRainSoFar,Pressure,Raincounter,InsideTemp,InsideHumidity,LatestWindGust,WindChill,HeatIndex,UVindex,SolarRad,Evapotrans,AnnualEvapTran,ApparentTemp,MaxSolarRad,HrsSunShine,CurrWindBearing,RG11rain,RainSinceMidnight,WindbearingSym,CurrWindBearingSym) Values('18-07-16 21:58',78.9,82,72.9,0.0,0.0,0,0.00,0.00,29.958,19.60,74.8,49,0.0,78.9,78.9,0.0,0,0.000,0.000,88.1,0,0.0,0,0.00,0.00,'N','N')
2018-07-16 21:58:00.211 MySQL: 1 rows were affected.
2018-07-16 21:58:26.675 Error connecting ftp - The connection was terminated before a greeting could be read.
2018-07-16 21:58:26.712 Error encountered during MySQL operation.
2018-07-16 21:58:26.712 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DAYS)' at line 1
2018-07-16 21:58:26.718 Error uploading realtime.txt to realtime.txt : Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.
2018-07-16 21:58:56.681 Error connecting ftp - The connection was terminated before a greeting could be read.
2018-07-16 21:58:56.725 Error encountered during MySQL operation.
2018-07-16 21:58:56.726 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DAYS)' at line 1
2018-07-16 21:58:56.732 Error uploading realtime.txt to realtime.txt : Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.
2018-07-16 21:59:00.220 Writing log entry for 7/16/2018 9:59:00 PM
2018-07-16 21:59:00.221 Written log entry for 7/16/2018 9:59:00 PM
2018-07-16 21:59:00.223 Writing today.ini, LastUpdateTime = 7/16/2018 9:59:00 PM raindaystart = 19.6 rain counter = 19.6
2018-07-16 21:59:00.224 INSERT IGNORE INTO Monthly (LogDateTime,Temp,Humidity,Dewpoint,Windspeed,Windgust,Windbearing,RainRate,TodayRainSoFar,Pressure,Raincounter,InsideTemp,InsideHumidity,LatestWindGust,WindChill,HeatIndex,UVindex,SolarRad,Evapotrans,AnnualEvapTran,ApparentTemp,MaxSolarRad,HrsSunShine,CurrWindBearing,RG11rain,RainSinceMidnight,WindbearingSym,CurrWindBearingSym) Values('18-07-16 21:59',78.9,82,72.9,0.0,0.0,0,0.00,0.00,29.958,19.60,74.8,49,0.0,78.9,78.9,0.0,0,0.000,0.000,88.1,0,0.0,0,0.00,0.00,'N','N')
2018-07-16 21:59:00.263 MySQL: 1 rows were affected.
2018-07-16 21:59:26.694 Error connecting ftp - The connection was terminated before a greeting could be read.
2018-07-16 21:59:26.732 Error encountered during MySQL operation.
2018-07-16 21:59:26.733 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DAYS)' at line 1
2018-07-16 21:59:26.739 Error uploading realtime.txt to realtime.txt : Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.
2018-07-16 21:59:56.693 Error connecting ftp - The connection was terminated before a greeting could be read.
2018-07-16 21:59:56.733 Error encountered during MySQL operation.
2018-07-16 21:59:56.734 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DAYS)' at line 1
2018-07-16 21:59:56.739 Error uploading realtime.txt to realtime.txt : Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.

Re: Possible issue inserting data into sql db

Posted: Tue 17 Jul 2018 7:22 am
by steve
It looks like the inserts shown are working OK, but you have a problem with your syntax for a different insert - probably a problem with your retention string.

Re: Possible issue inserting data into sql db

Posted: Tue 17 Jul 2018 11:02 am
by stefanbagnato
Steve, any idea how to fix? Is there more info I should share with you? Outside of keeping the text files updated using the exact same data categories as before strike (IE I figured out the headings and which columns needed a decimal and so on...) I didn't change anything else.

Re: Possible issue inserting data into sql db

Posted: Tue 17 Jul 2018 6:02 pm
by steve
You could show your SQL settings, it may be easy for someone to spot. I may not be much help for a few days, I am away from home, typing this on my phone in a restaurant waiting for my food to arrive.