I am new in using MySQL database and need some help. The scenario is pretty much like this: I collect data from some sensor which come with their own software. The software builds a .db file as it takes data from the sensors and saves it locally in the computer.

My problem is to collect this data from the .db file and input it into a MySQL database with a certain frequency.

Is it possible to create a script that updates the MySQL database with .db files (lets say every 5 secs)? Can you provide some direction on what to use?

Thank You in advance!

PS: .db format should be like this
http://www.monnit.com/images/sensor-data/Vehicle-Profile-1-Data.jpg

Hello shqiptari88,

Unfortunately .db files aren't something that can be uploaded straight into a MySQL Database natively, furthermore it could be any type of database as .db is just a generic filename for storing database data.

If you can work out what sort of .db it is, then it might give us some more to work with. If you right click the file, and edit with something like notepad, gedit or text edit then copy and paste a small portion of what appears. I am hoping that it is going to be some form of SQL, which shall make life a lot easier.

Good luck!

If it is being generated by an SQLite database, then it should be simpler to import it into the database.
Unfortunately the image doesn't give enough information, it is showing it displayed however it doesn't show how the queries are being generated.

If you can afford to wait a couple of minutes, then you could try running a CRON job and flashing the query every couple of minutes. What OS are you running?

I don't know the details of your experiment, but it might be more suitable to upload it to the database in sections such as every five results or every ten minutes?

I am using Windows. I cannot go to Linux since the software that deals with the sensor data is not compatible with Linux.
Is it possible to make the running frequency in terms of seconds, (15sec would be ok)?
I should get an actual .db file in a couple of days, once I;ll have that I will post it here

I'm not familiar with Windows time management other than Scheduled Tasks which, much like the Linux cron, can't be run efficiently in times less than a couple of minutes.

After doing a quick bit of research, there is supposedly one called 'soon' which you can find the details for Here. If this fails, then the only other quick solution I can think of (without developing a complete piece of software) would be to use a JavaScript and AJAX call, with the JavaScript counting down and the AJAX making a simultaneous call to the database with the new data.

I would try the soon command first though. I'm not sure how you have setup your database, but you shall probably want to run a web server and use a PHP file to execute your query. You can download what is called a WAMP stack which is:

Windows, Apache (Web Server) MySQL and PHP.

XAMPP is a good solution, all you need to do is download it and click on start.

Good luck!

any suggestions please?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.