Course 9 - Data acquisition for robots
Install a database server
This lecture is about database servers. You will learn how SQL database servers store information. You will learn how you can connect to such a database server, how you can save, delete and query information. In this lecture you will install a MySQL database server and you will connect your Ozeki 10 system to it. These skills can be applied to other database servers, such as Oracle, Microsoft SQL server etc.
- Ozeki 10 installed: Installed Ozeki 10 Robot OS
- Lego connection installed: Connect the Lego robot to Ozeki 10
- XAMPP downloaded: https://www.apachefriends.org/download.html
Download the XAMPP application and start it !
To create the database server on your own machine, you need to download the XAMPP software. You can find the link above, in the Requirements menu. It will guide you to the download page of XAMPP and here you can select the latest version. After the download is finished, just start installation by clicking on the file. Here you can select which components (Figure 2) to install and the installation folder, but there won't be any problem if you leave these as default.
Figure 2 - Leave all components selected and install XAMPP
Start Apache and MySQL services from your XAMPP !
When the installation of XAMPP finished, you need to open the XAMPP Control Panel. If you checked the option to run the Control Panel automatically when the installation is finished, it may open up for you, but if not, you can open it by clicking on its icon on the tray or by clicking on its icon in the installation folder. In this Control Panel you can see all services that XAMPP provides. To start the database server, you will need the Apache and MySQL services. You can easily start these two services by clicking on the Start button next to both Apache and MySQL (Figure 3).
Figure 3 - Start Apache and MySQL from the XAMPP Control Panel
Click on the Admin button at MySQL service to create a new database server user account and grant all privileges !
Click on the Admin button next to the MySQL service button the XAMPP Control Panel, the database server will open up in your browser. This is the place where you can manage all your tables, databases and user accounts that can be found on the server. The first thing you need to do is to create a new user account that can be connected to Ozeki 10 later. So please click on User accounts on the top bar (Figure 4) and click on Add user account to create a database user.
Figure 4 - The database user account list in the phpMyAdmin user interface
Then you need to specify the details of the user account. First you have to type a username for the account and then select the host name which needs to be Local this time. Finally type and re-type the password you have to memorize, because you will need it when connecting this database account to Ozeki 10. Below you need to click the 'Create database with same name and grant all privileges' checkbox and the 'Global Privileges' option (Figure 5). If you did all these settings, you can click on the 'Go' button and your user account has been successfully created.
Figure 5 - See how to configure the new user account
What is a 'database' ? Please define it!
Database - stores information that is organized into tables, rows and columns, so it can be easily accessed, managed and updated.
Open Ozeki 10 and connect the database to the Control Panel!
With the newly created database server and database, you built everything that you need to save the data into them. But if you want to use the database on your robot, you have to connect it to Ozeki 10. The database in Ozeki 10 will be handled as a connection, so the connection creating procedure will be the same as the others before. You only need to click on Create new Connection in Control Panel and after that, select the 'Application' method (Figure 6).
Figure 6 - Basic connection categories in Ozeki 10
After selecting Application method, you will see all options that Ozeki 10 provide. Please select 'Database' to create a database connection, here you should select 'Messaging' or 'Queries'. When you click on it, all type of databases appear, but please select 'MySQL' (Figure 7), because you have created a MySQL database server and user with a password in Task #3.
Figure 7 - All available database connection in Ozeki 10
The final part of this step is to specify the connection details of the database connection. First give a name to the connection, since the applications of Ozeki 10 will be able to see it. Then you need to type the details of the database that you want to connect (Figure 8). Here you can leave Server and Port as default, but to the Database, UserID and Password fields you have to type the details of the database and user account that you created in Task #3. If you have created the database the same time as the user account, the name of the database will be the same as the UserID.
Figure 8 - Type connection details for your MySQL database
Create SQL Messaging connection in Ozeki 10
to use your database!
In the final task of this lecture you have to create a messaging connection with the connected database. For that just create a new messaging connection, so in Control Panel click on Create new Connection and here you need to select the 'Messaging' method. To use the database to store the incoming and outgoing messages you need to choose the SQL SMS connection (Figure 9).
Figure 9 - Messaging connections in Ozeki 10
In the connection details of the SQL Messaging connection you can give a name to the connection as it was in all other connections you created before. Below that you can select which database connection you would like to use in the messaging connection (Figure 10). If you haven't created the database connection till this point, you can create a new one as you saw it in Task #5.
Figure 10 - Connection details of SQL messaging connection