ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a program which needs to access a database of information but that the database must be 'enclosed' in the application (no retreiving the data from an external database), how would i go about that ? For instance i have a c++ program which reads from a text file all the data it needs and then stores the data in a hash table until the program exits. Obvioulsy this takes a toll on system memory and is dependant on a easily modifiable text file.
I once made a front end for a database in visual basic. The app used a access database file for the data storage and accessed the data through vb's sql implementation. I didn't like how the data was obviously a data file and could easily be tampered or cracked.
So how do modern apps go about solving this problem, accessing and storing data (taking in to account that data may need to be modified, added etc), and how to enclose the data neatly in the application, by this i mean that in the install directory the user won't see a collection of databases they can extract to tamper.
A good example of this type of program would be a dictionary. How can you implement the database to hold the words in c++, or in java ? If you know how to do it in a different language and the technique is very different to java or c++ please post too.
sqlite is good for this, but there's still a file hanging around if you want it to be persistent. There's no real way of doing this very easily... nor do I understand the need to do it.
Unless you are going to try to write self modifying code, an external file is needed for persistence between program runs.
Depending on the security requirement, you could save it in binary form (stops casual crackers), or encrypt it if you're really paranoid...
Perhaps you could give us a bit more background as to why you want this ...?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.