Ehs8 with database | Thales IoT Developer Community
May 6, 2017 - 1:53am, 3672 views
Good night.
I have a "DSB-mini" with a "DSB multi adapter a4" and "EHS 8" with a sim that take gps position, by other hand, I have installed on my desktop apache server with mysql.
How could I send the gps position from "EHS8" to my database? I have seen the netdemo example but I still don´t know how to do it.
Thanks for help.
Hello,
The general solution is up to you. The Java API for the module provides the socket and http[s] connections.
Probably the easiest way would be to use HTTP POST to send the GPS data to the server. You can find the POST example in the API.
You would need some PHP script for example on the server to store the data to the database.
There's also XML API available so you could use it to format the data. To use JSON for example you'd need to find some library in the network and adopt it.
Regards,
Bartłomiej
Good morning Bartlomiej, thank for answer.
Then I can´t do querys directly from ehs8 module as I have seen because module use Micro Edition (ME) :S.
I have seen api and looking for some example. Code will be similar this, no?
About script, if two ehs8 modules try to use php script at the same time, what would happened?
Thanks for help.
Hello,
To directly access the database you'd need some driver which is not provided by the standard API for the module.
Your example is for Java SE. Here we don't have HttpPost and generics but we do have HttpConnection interface. Let me paste the POST example with HttpConnection interface taken form our API for comparison:
As for the PHP script on the server side I think that this question is more accurate for Apache/PHP/MySQL forum. The database is transactional, Apache server must be prepared for multiple access and there are probably additional techniques to ensure concurrency without data loss or other errors. But I'm not the expert here.
Regards,
Bartłomiej
Good morning Bartlomiej.
I`m doing something wrong maybe when I add post params because php script says me that no exits post params.
The code run ok, without warnings, exceptions. But script says that params are undefined.
This is part of my script:
I have tried with eclipse in localhost and Java SE code without modifying php script and run perfect doing insert.
What i´m doing wrong?
Thanks for help.
I found the problem. I had to add:
I have seen that only with this property all works, and when I open conector, connProfile is not neccesary:
Thank for all Bartlomiej.
Hello,
Great! Thanks for the update.
Regards,
Bartłomiej