On using Groovy

Use Groovy commands to test & execute crop scripts. Leafnode uses this tool and they've made it available for us.  This is very handy when we modify or correct the scripts.

Step-by-step guide

  1. DownloadGroovy zip file on their website Click the Download icon and save the zip file.


  2. Unzip in your application folder. Ex. C:\


  3. Set up the environment variables for GROOVY, JAVA and MYSQL and append in your Path.


  4. Go to your DBScripts GitHub repository and open the folder \DBScripts\setuputils. For more info, open README.md in a text editor.
    Read the section ## Create DB Schema on executing Groovy commands.


  5. Use Windows cmd line. Change directory (cd) to \DBScripts\setuputils\ to execute groovy files specifically createcropschema.
    Run `groovy createcropschema.groovy ibpdm {crop name} merged`


    where {crop name} is the name of the crop folder on GitHub \DBScripts\merged



  6. It runs 2 sets of scripts from folders \DBScripts\merged\common and \DBScripts\merged\{crop-specific scripts}

  7. Pls. take note of any error - especially from crop-specific scripts you're working on. Ex.


  8. If there's an error, pls. fix and run the groovy command again until no more error messages from crop-specific scripts are shown.

  9. You may disregard this message on the workbench when running the groovy command multiple times on the same crop.


  10. The crop(s) will be successfully installed and accessible from the BMS app.

Troubleshoot

Email from Naymesh of Leafnode:

Hi All!

Its great that you all are also using the Groovy scripts to test DB creation after making your changes and before committing/pushing. This ensures that the scripts in DBSctipts/master are always in working condition. Thanks!

  1. The full-text index and db engine issue:

    We use Grovvy scripts with latest sql scripts in master and do not see this error. This leads me to believe that you might be using an older MySQL version. Can anyone please confirm which version of MySQL you are working with? You should be using MySQL version 5.6 as that is what BMS ships and works with. 

  2. The "MySQL server has gone away" issue:


    • This occurs when the server connection is lost because of server crashing, timing out or shutting down for some reason. See the manual for error details.
    • We have seen this error occurring when loading large database dumps into MySQL via groovy script, due to server timing out. Fix for that is to increase the default packet size, instructions for which are part of the README.

Configure my.ini

Instruction from Matthew in configuring my.ini:

You need to configure MySQL to read in larger files. GDMS is not large, but larger than the MySQL default.  On Windows, it usually lives in the MySQL installation directory and is called my.ini.  You need to add this line to the file:

max_allowed_packet=64M 

Then that message will stop and the GDMS data will load.

** Restart the MySQL service to reflect the changes on the my.ini file

There is no content with the specified labels