I am using Embarcadero C++ Builder and I am trying to collect as much information as I can so that I can start making my program. I want to make a client/server program. I am going to use databases and I need a way to transfer the database from the client computer to my server computer. And if a client PC gets destroyed for real I need to send the client his database back.
How can I do this?
I'm assuming you'll be using Firebird for your database, since it's the default for C++Builder/Delphi. Firebird maintains its database in a single file, so you will need to transfer it with network components, like Indy, a great socket library that comes with C++Builder. Here is an article about data transfer through network with Delphi (easily translatable to C++). Good luck!
Related
I'm trying to send queries to a SQL database from a Windows CE 7 C++ application running on an ARM architecture.
During my research I found several possibilities to do this:
Use methods from system.data.sqlclient
Doesn't work, since the application is not supporting CLR
Use ODBC or OLEDB
I read at several points that both won't work on Windows CE
Use HTTP requests from winInet to send the data as JSON to the DB and parse it back there
Just an assumption that this could work, not confirmed
So I'm wondering what other/better ways there are to send these queries.
Thanks for your help!
If it is a pocket pc sql server lite database then you can use ADOCE to access and configure your database. The service'esqe approach is also valid and will take the data access burden from your client application.
you can implement your third option but you need to implement also another software component (on the SQL server side) to do the following work:
connect to the database;
decode the JSON and query the database;
encode the database answer in JSON and send back to your WEC7 application.
If you are familiar with C# and if you have .NET compact framework installed on your WEC7 machine you could also implement the software component that will send HTTP REQUEST in plain C# (without the need to study wininet).
Hope this helps
I want to make a smart little project where I receive data from an embedded linux (petalinux) into a phonegap app (Android).
The question is, what type of protocols are prefered?
I recently read about socket io and it looks great.
But how can I get the app to communicate from for example c or c++ to javascript and html?
The data will probably be stored into a sqlite database inside the embedded linux, or will someone prefer a better real time database system (RTDBS)?
Any ideas? Thanks.
I'm trying to modify a game engine so it records events (like key presses), and store these in a MySQL database on a remote server. The game engine is written in C++, and I currently have the following straightforward architecture, using mysql++ to directly INSERTrecords into appropriate databases:
Unfortunately, there's a very large overhead when connecting to the MySQL server, and the game stops for a significant amount of time. Pushing a batch of Xs worth of events to the server causes a significant delay in gameplay (60s worth of events can take 12s to synchronise). There are also apparently security concerns with leaving the MySQL port accessible publicly.
I was considering an alternative option, instead sending commands to the server, which can interact with the database in its own time:
Here the game would only send the necessary information (e.g. the table to update and the data to insert). I'm not sure whether the speed increase would be sufficient, or what system would be appropriate for managing the commands sent from the game.
Someone else suggested Log4j, but obviously I need a C++ solution. Is there an appropriate existing framework for accomplishing what I want?
Most applications gathering user-interface interaction data (in your case keystrokes) put it into a local file of some sort.
Then at an appropriate time (for example at the end of the game, or the beginning of another game), they POST that file, often in compressed form, to a publicly accessible web server. The software on the web server decompresses the data and loads it into the analytics system (the MySQL server in your case) for processing.
So, I suggest the following.
stop making your MySQL server's port available to people you don't know and trust.
get your game to gather keystrokes locally somehow.
get it to upload that data in big bunches when your game is not in realtime mode.
write a web service to receive and interpret these files.
That way you'll build a more secure analytics system and a more responsive game.
I want to make an application 'x' with an embedded database.If i make another application 'y' without an embedded database,will it be possible to read and update the database in application 'x'.
I'm not sure what you mean by "embedded" database mysql. Your application will connect to mysql via socket and any other application will connect to it (assuming it has right credentials). Alternatively you could use sqlite which is easier to manage in a desktop app environment.
Consider the needs of the solution. If you need to share the data, create a shared database. If you need to share business logic, create an application that services requests from that database. I'm am not sure what MySQL's capabilities are regarding embedding a database inside the application, but if you're embedding the database in an application, the data should stay inside the application.
No, I don't think so. Because you are using an embedded database it's actually part of your application (embedded) so it doesn't have any external interface as such. That's because embedded MySQL doesn't run a database server process to listen to requests. The database access logic is all linked into your application.
You could either:
Have application X listen on a port and forward requests to it's embedded DB, this at least abstracts away from the fact that it is DB in the background, it would look juist like any other service.
Use a non embedded DB, this should be pretty simple to setup really. You could have X start and stop the DB server when it starts and stops.
Use a file based database like SQLLite.
i am writing an program in c++ and i need an web interface to control the program and which will be efficient and best programming language ...
Your application will just have to listen to messages from the network that your web application would send to it.
Any web application (whatever the language) implementation could use sockets so don't worry about the details, just make sure your application manage messages that you made a protocol for.
Now, if you want to keep it all C++, you could use CPPCMS for your web application.
If it were Windows, I could advice you to register some COM component for your program. At least from ASP.NET it is easily accessible.
You could try some in-memory exchange techniques like reading/writing over a localhost socket connection. It however requires you to design some exchange protocol first.
Or data exchange via a database. You program writes/reads data from the database, the web front-end reads/writes data to the database.
You could use a framework like Thrift to communicate between a PHP/Python/Ruby/whatever webapp and a C++ daemon, or you could even go the extra mile (probably harder than just using something like Thrift) and write language bindings for the scripting language of your choice.
Either of the two options gives you the ability to write web-facing code in a language more suitable for the task while keeping the "heavy lifting" in C++.
Did you take a look at Wt? It's a widget-centric C++ framework for web applications, has a solid MVC system, an ORM, ...
The Win32 API method.
MSDN - Getting Started with Winsock:
http://msdn.microsoft.com/en-us/library/ms738545%28v=VS.85%29.aspx
(Since you didn't specify an OS, we're assuming Windows)
This is not as simple as it seems!
There is a mis-match between your C++ program (which presumibly is long running otherwise why would it need controlling) and a typical web program which starts up when it receives the http request and dies once the reply is sent.
You could possibly use one of the Java based web servers where it is possible to have a long running task.
Alternatively you could use a database or other storage as the communication medium:-
You program periodically writes it current status to a well know table, when a user invokes the control application it reads the current status and gives an appropriate set of options to the user which can then be stored in the DB, and actioned by your program the next time it polls for a request.
This works better if you have a queuing mechanism avaiable, as it can then be event driven rather than polled.
Go PHP :) Look at this Program execution Functions